Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

crontab every minute on raspberry

Tags:

raspberry-pi

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?

like image 823
carlos palma Avatar asked Nov 01 '13 19:11

carlos palma


2 Answers

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.

like image 158
Craig Avatar answered Sep 20 '22 20:09

Craig


#min hour day month weekday command
*/1   *    *    *    *     <your command>

Give that a shot

like image 29
crownedzero Avatar answered Sep 20 '22 20:09

crownedzero