* Wait for jobs to finish.
svn path=/nixos/trunk/; revision=7418
This commit is contained in:
parent
af1c54fbdc
commit
a630a314f2
@ -41,12 +41,21 @@ if test "$action" = "switch" -o "$action" = "test"; then
|
|||||||
echo "old: $oldEvents"
|
echo "old: $oldEvents"
|
||||||
echo "new: $newEvents"
|
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
|
# Stop all services that are not in the new Upstart
|
||||||
# configuration.
|
# configuration.
|
||||||
for event in $(cd $oldEvents && ls); do
|
for event in $(cd $oldEvents && ls); do
|
||||||
if ! test -e "$newEvents/$event"; then
|
if ! test -e "$newEvents/$event"; then
|
||||||
echo "stopping $event..."
|
echo "stopping $event..."
|
||||||
initctl stop "$event"
|
stopJob $event
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -66,7 +75,7 @@ if test "$action" = "switch" -o "$action" = "test"; then
|
|||||||
initctl start "$event"
|
initctl start "$event"
|
||||||
elif test "$(readlink "$oldEvents/$event")" != "$(readlink "$newEvents/$event")"; then
|
elif test "$(readlink "$oldEvents/$event")" != "$(readlink "$newEvents/$event")"; then
|
||||||
echo "restarting $event..."
|
echo "restarting $event..."
|
||||||
initctl stop "$event"
|
stopJob $event
|
||||||
initctl start "$event"
|
initctl start "$event"
|
||||||
else
|
else
|
||||||
echo "unchanged $event"
|
echo "unchanged $event"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user