3

I checked the time on my pi to make sure it's right by running date and I believe I set my cron job correctly, I wish for it to run at 9am and 9pm, but they're running instead at 7am and 7pm.

Here's my cron tab:

0 9,21 * * * sh /home/pi/.myscript.sh

What I am I doing wrong here?

3

Cron is very sensitive to large time shifts, in this case, i'll bet timezone, so just try to restart it.

Type:

/etc/init.d/cron restart

That might fix it.

  • I've given this a try, will see how it goes. Also, /etc/init.d/crond restart doesn't work for me, but /etc/init.d/cron restart does. I'm guessing this refers to the same thing? – basica Apr 9 '14 at 10:58
  • Yes, Debian and Ubuntu use cron instead of crond, i didn't knew your system, but I should have assumed that you would be using Raspbian. I'll edit it. – GonacFaria Apr 9 '14 at 11:03
  • 2
    It could also be related to differences in timezones. do you have timezones configured for your profile? (look for TZ=.... in your .profile) Check also /etc/rc.conf and look for the TIMEZONE variable – Roberto Apr 9 '14 at 11:48
  • 1
    yep, this did the trick. – basica Apr 9 '14 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.