
Start Desktop Applications Automatically #72
Chapter 9, Administration and Automation
|
221
HACK
Automate NTP Synchronization
Apart from setting your clock, one of the best uses of NTP is to synchronize
your clock regularly to compensate for the natural drift that occurs with a
hardware clock. This drift is caused by various issues such as power fluctua-
tions and hardware problems, but if you synchronize with NTP as often as
possible, you can reduce this drift.
To schedule synchronization at regular intervals, use a cronjob to automate
these NTP updates. “Automate Your Life with cron”
[Hack #70] fully explains
the uses of cron. You can create your cronjob by opening the
cron file with:
foo@bar:~$ crontab -e
Then add a line to define the cronjob. As an example, to synchronize your
clock once a day at 3:00 a.m., use this line:
00 03 * * * ntpdate ntp.yourserver.com > /dev/null
When you save and quit the editor, your cronjob will be enabled and your
clock will be updated regularly.
HACK
#72
Start Desktop Applications Automatically Hack #72
Start tools, utilities, and applications automatically as soon as you start your
favorite desktop or window manager.
You might want to start a number of programs automatically as soon as you
launch your window manager or desktop environment. For example,
assume you set up your LinEAK keyboard utility so that you can use all the
special keys on your Internet and multimedia ...