Linux System Administration
It may not appear difficult to keep your clock set correctly. DOS had the ability to set its time directly from the BIOS (Basic In/Out System) and you could set the BIOS time directly from DOS. Now you have to worry about time zones, machine time vs. software time, and finding out how to set the time when your system could be off by 30 seconds every day.
It's easy to set up your system for the correct time and if you're networked, it's easy to keep your time updated. First, get a copy of the zoneinfo package. For releases like Slackware, it is already installed (and may be already set up in Slackware 1.2.0 and later). Look for the /usr/lib/zoneinfo directory. If you don't have that directory, get a copy of the package (see sidebar “Finding zoneinfo”) and install it.
For the best setup, you should set your BIOS (or hardware) clock for GMT (or Zulu, Universal time, or whatever you want to call it). The advantage of having your BIOS clock set to GMT is that Linux will automatically handle daylight savings time conversions for your particular area. You may not want to do this if you still use DOS, but I find that DOOM does not care what time I play. I also found that people in the office think you're really dedicated when you bring in files with time stamps of 2:30AM.
The first thing you should do is boot into Linux and go into the /usr/lib/zoneinfo directory. You should see a list of various time zones. Some are listed by country, some have directories with more listings under them (such as the US directory). Find the file that works with your country or time zone. For my system, this would be the US/Eastern file, as I am in the Eastern Time Zone for the US. If your country is not listed, there is a list of files that relate to times + or - to GMT, such as GMT-6. Find out how far off you are from GMT, and use that file instead.
From here, I create a symbolic link from /usr/lib/zoneinfo/localtime to /usr/lib/zoneinfo/US/Eastern:
ln -sf /usr/lib/zoneinfo/US/Eastern /usr/lib/ zoneinfo/localtime
Another file to link is the posixrules file. This can be linked to localtime. If you have the TZ variable set, the posixrules link will be used to set the correct time zone.
ln -s /usr/lib/zoneinfo/ localtime /usr/lib/ zoneinfo/posixrules
If your BIOS clock is set to GMT, you have to tell Linux this using the clock command. The best way to do it is edit your /etc/rc.d/rc.local file (or /etc/rc.local file if you don't have an rc.d directory) and add the following command anywhere in the file:
#Tell Linux the BIOS is universal time! clock -us
Or if you have your clock set to local time:
#Tell Linux that the BIOS is set for local time already! clock -s
The -s option indicates to set the clock, and the -u option indicates that the BIOS clock is set to 'universal time', or GMT.
From now on, when you use the date command to view the time, you will see the correct local time, along with the time zone you are in:
#date Thu Aug 10 22:15:35 EDT 1994
It's easy to set up your system for the correct time and if you're networked, it's easy to keep your time updated.
If you're networked to other machines with a better sense of time than yours, you can use the netdate command to periodically keep your machine time correct. As root on your machine, just enter the command:
netdate [ -v ] [ -l limit ] <hostl> ... <hostn>
where hostl...hostn is a list of hosts. It is usually best to list hosts that are physically close to your system, especially if you're using a dial-up PPP or SLIP.
The way neLdate works is to collect the hosts into groups based on how close the times are. Of the hosts with the times closest to the local time, the first alphabetical host of that group is used to set the time on the local host. The -v option will list the groups that get created, and the -1 limit option varied the amount of time that netdate will wait for time information from other hosts to come in. A limit of 0 will accept the time of the first host that responds and ignore all the others.
However, netGate does not update your BIOS clock, only the system clock. To update the BIOS clock, use the clock -uw command to 'write' universal time, or clock -w if you keep your BIOS set to local time. One idea you may want to try is creating a shell script which executes the netdate and clock commands automatically and keep it in your /etc directory. This way, if you notice the time is a bit off, you can execute the shell script to update the time, and update your BIOS clock simultaneously.
If you are interested in doing more with the time zones, check out the man pages for date, clock, and netdate. Also in the /usr/lib/zoneinfo directory is a time.doc text file which is good reading.
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?
|Non-Linux FOSS: libnotify, OS X Style||Jun 18, 2013|
|Containers—Not Virtual Machines—Are the Future Cloud||Jun 17, 2013|
|Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer||Jun 12, 2013|
|Weechat, Irssi's Little Brother||Jun 11, 2013|
|One Tail Just Isn't Enough||Jun 07, 2013|
|Introduction to MapReduce with Hadoop on Linux||Jun 05, 2013|
- Containers—Not Virtual Machines—Are the Future Cloud
- Non-Linux FOSS: libnotify, OS X Style
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Linux Systems Administrator
- Validate an E-Mail Address with PHP, the Right Way
- Introduction to MapReduce with Hadoop on Linux
- RSS Feeds
- Weechat, Irssi's Little Brother
- New Products
- Tech Tip: Really Simple HTTP Server with Python
- Reply to comment | Linux Journal
13 min 25 sec ago
- Didn't read
23 min 45 sec ago
- Reply to comment | Linux Journal
28 min 45 sec ago
- Poul-Henning Kamp: welcome to
2 hours 38 min ago
- This has already been done
2 hours 39 min ago
- Reply to comment | Linux Journal
3 hours 25 min ago
- Welcome to 1998
4 hours 13 min ago
- notifier shortcomings
4 hours 37 min ago
6 hours 14 min ago
- Android User
6 hours 15 min ago