diff --git a/modules/system/upstart-events/shutdown.nix b/modules/system/upstart-events/shutdown.nix index a8519edbd84f..02bce7979d0a 100644 --- a/modules/system/upstart-events/shutdown.nix +++ b/modules/system/upstart-events/shutdown.nix @@ -35,8 +35,8 @@ with pkgs.lib; # Stop all Upstart jobs. - initctl list | while read jobName rest; do - if test "$jobName" != shutdown; then + initctl list | while IFS=", " read jobName status rest; do + if test "$jobName" != shutdown -a "$status" != "stop/waiting"; then echo "stopping $jobName..." stop "$jobName" fi