e-smith-ntp/root/sbin/e-smith/systemd/initializedate

26 lines
718 B
Plaintext
Raw Normal View History

#!/bin/bash
#first move old drift file if in the way
OLDFILE='/etc/ntp/drift'
NEWFILE='/var/lib/ntp/drift'
if [ -f "$NEWFILE" ]; then
if [ -f "$OLDFILE" ];then
/usr/bin/rm -f $OLDFILE
fi
else
if [ -f "$OLDFILE" ];then
/usr/bin/mv $OLDFILE $NEWFILE
fi
fi
if [ -f "$NEWFILE" ]; then
/usr/bin/chown ntp:ntp $NEWFILE
fi
# Run ntpdate so we're not way off on startup.
ntpstep=/etc/ntp/step-tickers
tickers=`/bin/sed -e 's/\#.*$//g' $ntpstep`
#get current date (will need to update this command soon to be retired : ntpd -q -x -g -g -g -g
/usr/sbin/ntpdate -b -p 8 $tickers
# set hardware clock to the current time
/usr/sbin/hwclock --systohc
exit 0