* Support entering maintenance mode ("shutdown now") and powering off
the system ("halt"). svn path=/nixu/trunk/; revision=7083
This commit is contained in:
parent
7bba427e93
commit
49b2a218b5
@ -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.
|
||||
|
23
test/upstart-jobs/halt.nix
Normal file
23
test/upstart-jobs/halt.nix
Normal 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
|
||||
";
|
||||
|
||||
}
|
19
test/upstart-jobs/maintenance-shell.nix
Normal file
19
test/upstart-jobs/maintenance-shell.nix
Normal 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
|
||||
";
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user