On Friday 28 December 2001 11:01, you wrote:
> If you are connected to the internet all the time you can add a cron for
> rdate -

I'm not always connected, so I wrote this little script:
<<<<>>>>>>
#!/bin/sh
#
# Name: settime.sh
# This script syncs the Linux time to that on a public  
# NTP server ("Atomic Clock" just sounds better!) and 
# then equalises software and hardware clocks.
#
#dependencies: rdate, Xdialog
# 
# su to root first - rdate and hwclock need to run as root
# from a menu structure, call this script like this: "kdesu settime.sh"
#
u=`whoami`
r="root"
if [ "$u" != "$r" ]
then
        a="You are logged on as "$u
        a=$a". You must be root to run settime.sh"
        echo $a | Xdialog --no-cancel --textbox "-" 0 0 &
        exit 0
fi
 
Xdialog --screen-center --left --no-buttons --infobox "Preparing to sync 
time/date\nto atomic clock server." 0 0 5000 &

/usr/bin/rdate -s clock-1.cs.cmu.edu
sleep 1
/sbin/hwclock --systohc

Xdialog --screen-center --left --no-buttons --infobox "Time/date synced to 
atomic clock\nThis dialog will self-destruct\nin 5 seconds .. 4 .. 3 .. 2 
.. 1" 0 0 6000 &

<<<<>>>>>>

NB: It doesn't do any error-checking besides looking for root status.  If 
rdate couldn't connect to the ntp server, the script will cheerfully 
report success. Maybe in a later version ...
-- 
Michel Clasquin, D Litt et Phil (Unisa)
[EMAIL PROTECTED]/unisa.ac.za   http://www.geocities.com/clasqm
This message was posted from a Microsoft-free PC

f u cn rd ths, u cn gt a gd jb n nx dmnstrtn



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to