Hi all, thanks for helping me
i’ve created a bash file run-test.sh containing these few lines :
#!/bin/bash
# run-test.sh
k6 run --out influxdb=http://localhost:8086/myk6db thresholds_prod.js
When i run “sh run-test.sh” in command line, I’ve got any problem to feed influxdb and i can see results in Grafana dashboard.
But when i run my bash file with a cronjob, some data are missing like http_req_duration,
*/5 * * * * cd /home/company/user/rep/ && sh run-test.sh
Any idea of what can be different between manual and crontab launch?
Thank you.
Hi @ThierryK6, welcome to the forum
Running crontab jobs, in general, doesn’t do it with the same user you’ve done it and also it doesn’t run in the same shell like the one you probably use(which should be fixed by your shell wrapper).
I don’t think any of those will make a difference, but the first also means that it doesn’t use the same config file, so if you’ve set something in it, it will not be handled, like for example if you’ve configured influxdb.
some data are missing like http_req_duration,
Can you list which data isn’t missing ? Maybe that will give us some ideas …
I would expect that the script fails for some reason and doesn’t run HTTP requests at all. Can you see the log output of the cronjob?
Hi @mstoykov,
i’m using a predefined dashboard from dcadwallader. When running with crontab, only Virtual Users and Request per second are working in Grafana. (cf screenshot)
You have some “requests per second”, so I appernatly there are some requests being done.
Can you get the k6 log when it runs in a cronjob, this likely will have some messages pointing to what is going wrong.
Thank you @mstoykov
Actually, when i look at the k6 log every connection time was null. Seems like a proxy error.
I had this into my “run-test.sh”
export http_proxy=“http://proxy.company.fr:XXXX/”
export https_proxy=“http://proxy.company.fr:XXXX/”
Now, it works fine.
Thank you !