Utilizing a Time Server
I’ve got so much great email in my inbox, it looks like we can get a head-start on this week’s DIY Friday.
Today’s GnomeCORE is a cool tip from Adrian Williams on syncing your Linux box to a network time server.
Firstly, I really enjoy receiving your newsletter each day – it makes for interesting and informative reading.
Second, I wanted to setup my Linux file sever to auto sync its time clock with an atomic clock but didn’t know how to about this.
I located an excellent web site called Linux Step by Step that contains much excellent information, but had an article on time syncing that solved my problem. For the benefit of all the script is as follows:
if rdate -s clock-1.cs.cmu.edu; then
(Note: this example uses the clock at clock-1.cs.cmu.edu, but there are other clocks that may be appropriate to individual users.)
If your network is permanently connected to the Internet (eg via router) this script can be placed in the /etc/cron.daily directory to enable the server to update the time each day. Otherwise it can be included as part of the ppp script to activate when a connection is made.
The rdate program sets the system time from the atomic clock at clock-1.cs.cmu.edu and the hwclock command then sets the hardware clock from the system clock.
Any Windows machines can access the server time with the command:
NET TIME \servername /SET /YES
If you use SAMBA as a Windows NT Primary Domain Controller, placing the above line in the login batch file means the Windows machine syncs its time with the server automatically when the user logs on.