Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a sudo crontab like this to sync time:

# m h dom mow dow command

0 6 * * * ntpdate >> /var/mylog/ntp.log
0 7 * * * /var/mylog/ >> /var/mylog/backup.log

The problem I am having is that the first line (ntpdate) never seems to execute. If I run it manually with sudo that line works. cron does run the at the 7, but it never executes then ntp sync at 6. The syslog doesn't seem to show anything.

System is Ubuntu 10.04 LTS.

share|improve this question
Running ntpdate via cron is almost always the wrong thing to do. Why don't you install the ntp daemon? As for your problem, check the PATH? give the fully full path to ntpdate? – Zoredache Oct 17 '12 at 23:52
You are correct, in that PATH is the problem. I dont run ntpd because this system is on a vessel that connects and disconnects at certain times having seperate timing in all the conf files of different daemons is a pain. Why is ntpdate via cron 'wrong'? Why wouldn't it work? – kiasecto Oct 17 '12 at 23:59
ntpdate is deprecated; its functionality is now available with the -q option to ntpd. Since you have an intermittent network connection, it's probably best to run ntpd -q in a local script that fires whenever the network connection comes up, rather than within crontab. You'll also need to add iburst in /etc/ntpd.conf. – Michael Hampton Oct 18 '12 at 2:46
up vote 2 down vote accepted

When a cron job runs it does not have the full environment of a user, which means that the problem will be that ntpdate simple isn't found. To be sure you should specify the full path to a file to be executed in a cron task.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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