I am trying to get a shell script to run every minute on a raspberry pi, using crontab, like this:
crontab -e
and then:
* * * * * /home/pi/job.sh
where job is:
#!/bin/sh
echo "hello"
I am expecting the message to be sure that the script is being executed, but nothing ever happens. Is there any special trick to make the code run every minute on the raspberry pi?
The output of a job run via cron is, by default, emailed to the owner of the cron job.
My guess is that your script is running just fine and you have a bunch of email queuing up or if mail isn't configured, log messages about cron not being able to send email.
Try this in your script instead:
#!/bin/sh
date >>/tmp/crontest.txt
That will append the current date and time to the file /tmp/crontest.txt Check if the file is created and if there is a new line added every minute.
#min hour day month weekday command
*/1 * * * * <your command>
Give that a shot
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With