Logo
Explore Help
Sign In
public/nixpkgs
1
0
Fork 0
You've already forked nixpkgs
Code Issues Pull Requests Packages Projects Releases Wiki Activity
nixpkgs/modules/system/upstart-events/runlevel.nix

26 lines
467 B
Nix
Raw Normal View History

* Updated poweroff/reboot/maintenance mode for Upstart 0.6. Upstart no longer emits specific events for those. Instead it emits a "runlevel" event. The "runlevel" task starts the "shutdown" task to perform the desired action. * Upstart 0.6 no longer has a "shutdown" event, so "stop on shutdown" no longer works. Therefore the shutdown task explicitly stops all running Upstart jobs, before sending a TERM/KILL signal to all remaining processes. * Do a "chvt 1" at the start of the shutdown task to switch to the console. * Use /dev/console instead of /dev/tty1, since if somebody is logged in on tty1, bad things will happen. svn path=/nixos/branches/upstart-0.6/; revision=18224
2009-11-06 21:08:06 +00:00
{ config, pkgs, ... }:
with pkgs.lib;
{
jobs.runlevel =
{ name = "runlevel";
startOn = "runlevel [0123456S]";
task = true;
script =
''
case "$RUNLEVEL" in
0) initctl start shutdown MODE=poweroff;;
1) initctl start shutdown MODE=maintenance;;
6) initctl start shutdown MODE=reboot;;
*) echo "Unsupported runlevel: $RUNLEVEL";;
esac
'';
};
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 96ms Template: 9ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API