From 1dd2eb58bebac567b1ae665c3edcb0eaf374acaa Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 20 Feb 2007 16:25:49 +0000 Subject: [PATCH] * Set the hardware clock when shutting down. svn path=/nixos/trunk/; revision=7933 --- upstart-jobs/halt.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/upstart-jobs/halt.nix b/upstart-jobs/halt.nix index 4da444774a2..9e6c798ea86 100644 --- a/upstart-jobs/halt.nix +++ b/upstart-jobs/halt.nix @@ -12,6 +12,8 @@ assert event == "reboot" start on ${event} script + set +e # continue in case of errors + exec < /dev/tty1 > /dev/tty1 2>&1 echo \"\" echo \"<<< SYSTEM SHUTDOWN >>>\" @@ -20,18 +22,23 @@ script export PATH=${utillinux}/bin:${utillinux}/sbin:$PATH + # Set the hardware clock to the system time. + echo \"Setting the hardware clock...\" + hwclock --systohc --utc || true + + # Do an initial sync just in case. sync || true # Kill all remaining processes except init and this one. echo \"Sending the TERM signal to all processes...\" - kill -TERM -1 + kill -TERM -1 || true sleep 1 # wait briefly echo \"Sending the KILL signal to all processes...\" - kill -KILL -1 + kill -KILL -1 || true # Unmount helper functions. @@ -78,15 +85,18 @@ script cat /proc/mounts + # Final sync. sync || true + # Right now all events above power off the system. if test ${event} = reboot; then exec reboot -f else exec halt -f -p fi + end script ";