0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

* Wait for jobs to finish.

svn path=/nixos/trunk/; revision=7418
This commit is contained in:
Eelco Dolstra 2006-12-19 01:34:09 +00:00
parent af1c54fbdc
commit a630a314f2

View file

@ -41,12 +41,21 @@ if test "$action" = "switch" -o "$action" = "test"; then
echo "old: $oldEvents"
echo "new: $newEvents"
stopJob() {
local job=$1
initctl stop "$job"
while ! initctl list 2>&1 | grep -q "initctl: $job (stop)"; do
echo "waiting for $job..."
sleep 1
done
}
# Stop all services that are not in the new Upstart
# configuration.
for event in $(cd $oldEvents && ls); do
if ! test -e "$newEvents/$event"; then
echo "stopping $event..."
initctl stop "$event"
stopJob $event
fi
done
@ -66,7 +75,7 @@ if test "$action" = "switch" -o "$action" = "test"; then
initctl start "$event"
elif test "$(readlink "$oldEvents/$event")" != "$(readlink "$newEvents/$event")"; then
echo "restarting $event..."
initctl stop "$event"
stopJob $event
initctl start "$event"
else
echo "unchanged $event"