LX0-104 · Question #491
Which crontab entry could be used to set the system time at regular intervals?
The correct answer is B. 1 0 * * * ntpdate ntp1.digex.net. The ntpdate command, when scheduled in a crontab entry, can synchronize the system time with a specified NTP server at regular intervals.
Question
Options
- A1 0 * * * date $d $t $24
- B1 0 * * * ntpdate ntp1.digex.net
- C1 0 * * * date ntp1.digex.net
- D1 0 * * * runcron date ntp1.digex.net
- E1 0 * * * settime $d $t $24
How the community answered
(63 responses)- B94% (59)
- C3% (2)
- D2% (1)
- E2% (1)
Why each option
The ntpdate command, when scheduled in a crontab entry, can synchronize the system time with a specified NTP server at regular intervals.
The date command with $d $t $24 syntax is incorrect for synchronizing time with an NTP server; it's used for displaying or setting local time with specific arguments.
The ntpdate command is specifically designed for performing a one-time synchronization of the system clock with a specified Network Time Protocol (NTP) server. Using ntpdate ntp1.digex.net in a crontab entry will fetch the accurate time from ntp1.digex.net and adjust the local system clock accordingly at 00:01 daily.
The date command cannot directly synchronize with an NTP server using a server hostname; it's for local time management.
runcron is not a standard command for scheduling tasks within cron, and the command structure is incorrect for time synchronization.
settime is not a standard command for time synchronization, and the arguments are incorrect for NTP.
Concept tested: Cron job for NTP time synchronization
Source: https://man7.org/linux/man-pages/man8/ntpdate.8.html
Topics
Community Discussion
No community discussion yet for this question.