mirror of
https://github.com/PartialVolume/shredos.x86_64.git
synced 2026-02-20 09:35:26 +00:00
40 lines
605 B
Bash
40 lines
605 B
Bash
#! /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
|