* Support entering maintenance mode ("shutdown now") and powering off

the system ("halt").

svn path=/nixu/trunk/; revision=7083
This commit is contained in:
Eelco Dolstra 2006-11-20 20:50:52 +00:00
parent 7bba427e93
commit 49b2a218b5
3 changed files with 52 additions and 0 deletions

View File

@ -101,6 +101,16 @@ rec {
(import ./upstart-jobs/dhclient.nix {
dhcp = pkgs.dhcpWrapper;
})
# Handles the maintenance/stalled event (single-user shell).
(import ./upstart-jobs/maintenance-shell.nix {
inherit (pkgs) bash;
})
# Handles the reboot/halt events.
(import ./upstart-jobs/halt.nix {
inherit (pkgs) bash;
})
]
# The terminals on ttyX.

View File

@ -0,0 +1,23 @@
{bash}:
{
name = "sys-halt";
job = "
start on reboot
start on halt
start on system-halt
start on power-off
script
exec < /dev/tty1 > /dev/tty1 2>&1
echo \"\"
echo \"<<< SYSTEM SHUTDOWN >>>\"
echo \"\"
# Right now all events above power off the system.
exec halt -f -p
end script
";
}

View File

@ -0,0 +1,19 @@
{bash}:
{
name = "maintenance-shell";
job = "
start on maintenance
start on stalled
script
exec < /dev/tty1 > /dev/tty1 2>&1
echo \"\"
echo \"<<< MAINTENANCE SHELL >>>\"
echo \"\"
exec ${bash}/bin/sh
end script
";
}