mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-19 02:44:17 +03:00
* Set the hardware clock when shutting down.
svn path=/nixos/trunk/; revision=7933
This commit is contained in:
parent
e99ffcbe71
commit
1dd2eb58be
@ -12,6 +12,8 @@ assert event == "reboot"
|
|||||||
start on ${event}
|
start on ${event}
|
||||||
|
|
||||||
script
|
script
|
||||||
|
set +e # continue in case of errors
|
||||||
|
|
||||||
exec < /dev/tty1 > /dev/tty1 2>&1
|
exec < /dev/tty1 > /dev/tty1 2>&1
|
||||||
echo \"\"
|
echo \"\"
|
||||||
echo \"<<< SYSTEM SHUTDOWN >>>\"
|
echo \"<<< SYSTEM SHUTDOWN >>>\"
|
||||||
@ -20,18 +22,23 @@ script
|
|||||||
export PATH=${utillinux}/bin:${utillinux}/sbin:$PATH
|
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.
|
# Do an initial sync just in case.
|
||||||
sync || true
|
sync || true
|
||||||
|
|
||||||
|
|
||||||
# Kill all remaining processes except init and this one.
|
# Kill all remaining processes except init and this one.
|
||||||
echo \"Sending the TERM signal to all processes...\"
|
echo \"Sending the TERM signal to all processes...\"
|
||||||
kill -TERM -1
|
kill -TERM -1 || true
|
||||||
|
|
||||||
sleep 1 # wait briefly
|
sleep 1 # wait briefly
|
||||||
|
|
||||||
echo \"Sending the KILL signal to all processes...\"
|
echo \"Sending the KILL signal to all processes...\"
|
||||||
kill -KILL -1
|
kill -KILL -1 || true
|
||||||
|
|
||||||
|
|
||||||
# Unmount helper functions.
|
# Unmount helper functions.
|
||||||
@ -78,15 +85,18 @@ script
|
|||||||
|
|
||||||
cat /proc/mounts
|
cat /proc/mounts
|
||||||
|
|
||||||
|
|
||||||
# Final sync.
|
# Final sync.
|
||||||
sync || true
|
sync || true
|
||||||
|
|
||||||
|
|
||||||
# Right now all events above power off the system.
|
# Right now all events above power off the system.
|
||||||
if test ${event} = reboot; then
|
if test ${event} = reboot; then
|
||||||
exec reboot -f
|
exec reboot -f
|
||||||
else
|
else
|
||||||
exec halt -f -p
|
exec halt -f -p
|
||||||
fi
|
fi
|
||||||
|
|
||||||
end script
|
end script
|
||||||
";
|
";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user