LX0-103 · Question #168
Which crontab entry could be used to set the system time at regular intervals?
The correct answer is E. 1 0 * * * /usr/sbin/ntpdate ntp1.digex.net > /dev/null 2>&1. This question tests knowledge of the correct Linux command and syntax for synchronizing the system clock with a remote NTP server via crontab.
Question
Which crontab entry could be used to set the system time at regular intervals?
Options
- A1 0 * * * date $d $t $24
- B1 0 * * * settime $d $t $24
- C1 0 * * * date<ntp1.digex.net
- D1 0 * * * /usr/sbin/runcron date <ntp1.digex.net
- E1 0 * * * /usr/sbin/ntpdate ntp1.digex.net > /dev/null 2>&1
How the community answered
(25 responses)- A8% (2)
- C4% (1)
- D12% (3)
- E76% (19)
Why each option
This question tests knowledge of the correct Linux command and syntax for synchronizing the system clock with a remote NTP server via crontab.
The date command is used to display or manually set the system time using locally provided values, not to contact a remote NTP server, and $d $t $24 are not valid date command arguments.
settime is not a standard Linux command and does not exist as a recognized utility for NTP-based time synchronization on typical Linux distributions.
Using '<' to redirect the NTP server hostname as stdin input to the date command performs no network communication - the date command does not read NTP server addresses from stdin.
/usr/sbin/runcron is not a valid or standard Linux command, and attempting to redirect the NTP hostname via stdin to date still does not perform any network time synchronization.
The ntpdate command is the standard utility for querying an NTP server and immediately setting the system clock to match. The syntax '/usr/sbin/ntpdate ntp1.digex.net' correctly passes the NTP server hostname as a positional argument. Redirecting all output to /dev/null 2>&1 suppresses cron email noise, and '1 0 * * *' schedules it to run at 12:01 AM every day.
Concept tested: NTP time synchronization using ntpdate command in crontab
Source: https://linux.die.net/man/8/ntpdate
Topics
Community Discussion
No community discussion yet for this question.