blob: c9f55cff1cc2b132b8ae5fe90066ed67845ee682 [file] [log] [blame] [edit]
#! /bin/sh
#
# hwclock This writes the system time to the RTC on shutdown
#
RTC_DEVICE=rtc0
DAEMON=hwclock
# shellcheck source=/dev/null
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
# Quietly do nothing if /dev/rtc0 does not exist
[ -c /dev/$RTC_DEVICE ] || exit 0
start(){
: # Nothing to do on startup
}
stop(){
printf "Saving the system clock to /dev/%s\n" "${RTC_DEVICE}"
/sbin/$DAEMON -f "/dev/${RTC_DEVICE}" -w
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac