]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/setclock
2 ########################################################################
3 # Begin $rc_base/init.d/setclock
5 # Description : Setting Linux Clock
7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
13 ########################################################################
23 boot_mesg
"Setting system clock..."
25 # udev not create the rtc symlink if rtc is in the kernel
26 if [ ! -e /dev
/rtc
]; then
27 if [ -e /dev
/rtc0
]; then
32 hwclock --hctosys ${CLOCKPARAMS} &>/dev
/null
33 if [ ! ${?} == 0 ]; then
34 if [ ! -z /var
/log
/messages
]; then
35 boot_mesg
-n "No RTC found, set time to last log accesstime ... "
36 DATE
=`stat --format "%y" /var/log/messages | cut -d" " -f1`
37 TIME
=`stat --format "%y" /var/log/messages | sed -e "s|\..*||g" | cut -d" " -f2`
38 date -s $DATE > /dev
/null
46 boot_mesg
"Setting hardware clock..."
47 hwclock --systohc ${CLOCKPARAMS} &>/dev
/null
52 echo "Usage: ${0} {start} {stop}"