Author: eelco
Date: Fri Mar 16 21:24:51 2012
New Revision: 33176
URL: https://nixos.org/websvn/nix/?rev=33176&sc=1

Log:
* Upstart stupidly doesn't kill post-start scripts if we do "stop
  JOB", but it does kill the job's main process.  So if the post-start
  script if waiting for the job's main process to reach some state, it
  may hang forever.  Thus, the post-start script should monitor
  whether its job has been requested to stop and exit in that case.

Modified:
   nixos/trunk/modules/services/networking/portmap.nix

Modified: nixos/trunk/modules/services/networking/portmap.nix
==============================================================================
--- nixos/trunk/modules/services/networking/portmap.nix Fri Mar 16 21:17:13 
2012        (r33175)
+++ nixos/trunk/modules/services/networking/portmap.nix Fri Mar 16 21:24:51 
2012        (r33176)
@@ -87,7 +87,10 @@
           ''
             # Portmap forks into the background before it starts
             # listening, so wait until its ready.
-            while ! nc -z localhost 111; do sleep 1; done
+            while ! nc -z localhost 111; do
+                if [[ "$(status)" =~ stop/ ]]; then exit; fi
+                sleep 1
+            done
           '';
       };
 
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to