Create a separate bash script with the ntpdate command, and call that from cron. For some reason, calling commands directly from cron doesn't work.
Originally Posted by michael.doepper
Hello everyone!
I try to syncronize the system-time by using cron an ntpdate.
The concerning line in crontab is 1 * * * * ntpdate -s ip-address of time server
and by using the option -s the logging output is diverted to /var/log/syslog. In the next line
you see such a logging:
Aug 1 09:01:01 solarlinux /USR/SBIN/CRON[29560]: (root) CMD (ntpdate -s ...)
But if I check the remainig offset by ntpdate -q ip-address of time server,
its value doesn't become smaller, it seems as if ntpdate executed by cron does not
syncronize the time. Only if I execute the command manually in a shell, the offset
becomes notable smaller.
Does anybody have an idea how to solve this problem?
Thanks in advance!
Michael Doepper
Create a separate bash script with the ntpdate command, and call that from cron. For some reason, calling commands directly from cron doesn't work.
Originally Posted by michael.doepper
Thanks to Dave Bechtel for the response. But even if a seperate bash script was used, I had no success.
I found out, that the command in cron has to contain the full path of the command, instead of ntpdate
/usr/sbin/ntpdate has to be run.
Best regards
Michael Dopper

(New) AMD Ryzen 7 5700X 8 Core 16 Thread AM4 Unlocked 3.4 GHz CPU OEM Tray
$174.99
Intel Core i9-9900K SRG19 3.60GHz 16MB 8-Core LGA1151 B Grade CPU Processor
$175.00
Lenovo ThinkPad T14S Gen 1 8-Core 4750U 1.70 GHz 512 GB SSD 16 GB RAM Win11Pro
$240.00
Dell Optiplex 7050 Micro Core i5-7500 8 GB RAM 256GB SSD Microsoft Windows 11
$89.99
Intel Xeon E5 - 2667V2 / SR19W 3.30GHz 25MB 8-Core CPU Socket LGA2011
$30.00
AMD Ryzen 7 9800X3D 8-Core 4.7GHz AM5 CPU Processor 96MB L3 8MB L2
$350.00
AMD Ryzen 7 9700X 8-Core 16-Thread 40MB Cache Socket AM5 9000 Series Processor
$245.99
Microsoft Surface Go 2 Laptop Core i5 1135G7 2.4GHz 8GB 128GB SSD
$179.99
HP Z420 Pro Workstation PC Xeon E5-2660 8-Core 64GB RAM Quadro K5000 128GB SSD
$249.00
DELL Optiplex 780 SFF CORE2DUO 3.0GHz 8GB RAM 250GB HDDDVDRW NO OS
$99.99