Results 1 to 3 of 3

Thread: Problems with ntpdate by cron

  1. #1

    Problems with ntpdate by cron

    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

  2. #2
    Senior Member registered user
    Join Date
    Nov 2002
    Location
    USA, IL
    Posts
    1,041

    Re: Problems with ntpdate by cron

    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.

    Quote 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

  3. #3

    Problems with ntpdate by cron

    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

Similar Threads

  1. Trying to debug a cron job
    By turbine in forum General Support
    Replies: 8
    Last Post: 11-20-2006, 02:29 PM
  2. Cron
    By rrijkse in forum Customising & Remastering
    Replies: 2
    Last Post: 07-28-2004, 05:43 AM
  3. Replies: 1
    Last Post: 04-01-2004, 03:37 AM
  4. cron
    By punk000 in forum General Support
    Replies: 1
    Last Post: 02-24-2003, 07:21 PM
  5. unknown cron job
    By tegan in forum General Support
    Replies: 2
    Last Post: 02-01-2003, 01:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


(New) AMD Ryzen 7 5700X 8 Core 16 Thread AM4 Unlocked 3.4 GHz CPU OEM Tray picture

(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 picture

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 picture

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 picture

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 picture

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 picture

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 picture

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 picture

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 picture

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 picture

DELL Optiplex 780 SFF CORE2DUO 3.0GHz 8GB RAM 250GB HDDDVDRW NO OS

$99.99