LFCS · 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. This question asks for the correct crontab entry to synchronize the system time using an NTP server. The ntpdate command is specifically designed for one-time manual synchronization.
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
(59 responses)- B95% (56)
- C3% (2)
- D2% (1)
Why each option
This question asks for the correct crontab entry to synchronize the system time using an NTP server. The `ntpdate` command is specifically designed for one-time manual synchronization.
The `date` command with `$d $t $24` is used to display or set the system date/time, but these variables are not standard for specifying date/time from an external source or directly setting the time in this format within a script.
The `ntpdate` command is used to quickly set the system date and time by querying a Network Time Protocol (NTP) server, such as `ntp1.digex.net`, making it suitable for periodic time synchronization via cron. The `1 0 * * *` specifies the job to run at 00:01 daily.
While `date` can set the time, it cannot synchronize with an NTP server directly using a hostname as an argument for synchronization.
`runcron` is not a standard command or utility for scheduling or running cron jobs; cron itself handles the execution.
`settime` is not a standard command for setting system time in Linux; the `date` command is typically used.
Concept tested: Cron and NTP time synchronization
Source: https://linux.die.net/man/8/ntpdate
Topics
Community Discussion
No community discussion yet for this question.