PKGBUILDs/core/initscripts/hwclock
2011-05-25 23:45:00 -05:00

39 lines
756 B
Bash
Executable file

#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
case $HARDWARECLOCK in
UTC) HWCLOCK_PARAMS="--utc";;
localtime) HWCLOCK_PARAMS="--localtime";;
*) HWCLOCK_PARAMS="";;
esac
case "$1" in
start)
if [[ $HWCLOCK_PARAMS ]]; then
status "Adjusting Hardware Clock" \
/sbin/hwclock --adjust
stat_busy "Setting System Clock"
/sbin/hwclock --hctosys $HWCLOCK_PARAMS || stat_die
stat_done
# Note: This also enables /etc/cron.hourly/adjtime
add_daemon hwclock
fi
;;
stop)
if [[ $HWCLOCK_PARAMS ]]; then
stat_busy "Saving System Clock"
/sbin/hwclock --systohc $HWCLOCK_PARAMS || stat_die
stat_done
fi
rm_daemon hwclock
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac