home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- default=4.057
- if [ ! `whoami` = "root" ]; then
- echo "must be root"
- exit 1
- fi
-
- olddir=`pwd`
- name=`basename $0`
- dir=`echo $0 | sed -e s/"$name"//`
- cd $dir
-
- if [ $# -eq 0 ]; then
- echo " Enter the mean of the time lost each day in seconds"
- echo "default value is $default"
- echo "Press ctrl-c to abort"
- read seconds
- else
- seconds=$1
- fi
-
- if [ -z "$seconds" ]; then
- seconds=$default
- echo "Using default value for time"
- fi
-
- if [ $seconds -eq 0 ]; then
- echo "time is equal to 0"
- echo "aborting"
- exit 1
- fi
-
- cc -O correctclock.c -o correctclock -object -s
- if [ ! -f /usr/local/bin ]; then
- mkdirs /usr/local/bin
- fi
- cp correctclock /usr/local/bin
-
- if [ -f /usr/adm/correctclock.date ]; then
- rm /usr/adm/correctclock.date
- fi
- if [ -f /usr/adm/correctclock.log ]; then
- rm /usr/adm/correctclock.log
- fi
-
- echo -n "" >> /etc/crontab.local
-
- already=`grep "correctclock" /etc/crontab.local`
- cp /etc/crontab.local /etc/crontab.local.old
- if [ ! -z "$already" ]; then
- grep -v "correctclock" /etc/crontab.local.old > /etc/crontab.local
- fi
- echo "#correctclock : ">> /etc/crontab.local
- echo '0 9 * * * root /usr/local/bin/correctclock ' $seconds ' >>/usr/adm/correctclock.log 2>&1' >> /etc/crontab.local
- echo "30 12 * * * root /usr/local/bin/correctclock $seconds >>/usr/adm/correctclock.log 2>&1" >> /etc/crontab.local
-
- #initialize the date file
- /usr/local/bin/correctclock "$seconds" >>/usr/adm/correctclock.log 2>&1
-
- echo "Installed in /etc/crontab.local"
- cd $oldir
-
-