carlos palma
carlos palma

Reputation: 782

crontab every minute on raspberry

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?

Upvotes: 5

Views: 24305

Answers (3)

level6
level6

Reputation: 11

You could also use the age-old:

logger -t MyTag "MyTask: Completed successfully."

in your script if you would rather leave cron logging off and still see some output from your script in the system logs.

Upvotes: 1

Craig
Craig

Reputation: 4840

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.

Upvotes: 6

crownedzero
crownedzero

Reputation: 506

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

Give that a shot

Upvotes: 4

Related Questions