0

Cron job is setup as:

*/15  * * * * speedtest >> /home/pi/speedtest.log

The speedtest script is:

#!/bin/sh
speedtest-cli --csv >> /home/pi/speedtest.log

That uses Speedtest-CLI. The job is executing on time, but all I get is cron output that looks like:

Jul 19 08:17:01 raspberrypi CRON[29275]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 19 08:30:01 raspberrypi CRON[29378]: (pi) CMD (speedtest >> /home/pi/speedtest.log)
Jul 19 08:30:01 raspberrypi CRON[29377]: (CRON) info (No MTA installed, discarding output)
Jul 19 08:45:01 raspberrypi CRON[29430]: (pi) CMD (speedtest >> /home/pi/speedtest.log)
Jul 19 08:45:01 raspberrypi CRON[29429]: (CRON) info (No MTA installed, discarding output)
Jul 19 09:00:01 raspberrypi CRON[29608]: (pi) CMD (speedtest >> /home/pi/speedtest.log)
Jul 19 09:00:01 raspberrypi CRON[29607]: (CRON) info (No MTA installed, discarding output)
Jul 19 09:15:01 raspberrypi CRON[29791]: (pi) CMD (speedtest >> /home/pi/speedtest.log)
Jul 19 09:15:01 raspberrypi CRON[29790]: (CRON) info (No MTA installed, discarding output)

But I don't see the speedtest.log getting updated. What is going on?

2 Answers 2

2

I suspect that cron cannot locate the speedtest shell script. Try using a full path for this script in the cron job & see if that functions properly.

0

I had the same problem, and as @Scot suggested you need to use the full path.

Get the full path with: which speedtest-cli. In my case this outputs /usr/local/bin/speedtest-cli.

Use that in your cronjob (or bash file):

*/15 * * * * /usr/local/bin/speedtest-cli >> /home/pi/speedtest.log

I found that in this thread: https://www.reddit.com/r/linuxquestions/comments/n685tj/comment/gx5k27c/?utm_source=share&utm_medium=web2x&context=3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .