Skip to content

Instantly share code, notes, and snippets.

@marxjohnson
Last active August 29, 2015 14:01
Show Gist options
  • Save marxjohnson/c440a9f79dce73a0ac5f to your computer and use it in GitHub Desktop.
Save marxjohnson/c440a9f79dce73a0ac5f to your computer and use it in GitHub Desktop.
/etc/init/hwclock-save.conf for Ubuntu 12.04 with ACPI Wakealarm enabled
# hwclock-save - save system clock to hardware clock
#
# This task saves the time from the system clock back to the hardware
# clock on shutdown.
description "save system clock to hardware clock"
start on runlevel [06]
task
script
. /etc/default/rcS
[ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime"
[ "$BADYEAR" = "yes" ] && badyear="--badyear"
ACPITIME=`cat /sys/class/rtc/rtc0/wakealarm`
exec hwclock --rtc=/dev/rtc0 --systohc $tz --noadjfile $badyear
echo $ACPITIME > /sys/class/rtc/rtc0/wakealarm
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment