add s6-rc-up-tree: start reverse deps of controlled service
When s6-rc stops a service, it also stops everything that depends on it. but when it starts a service it starts only that service, so we have to go through the other services depending on it and figure out if they should be started too.
This commit is contained in:
24
pkgs/s6-rc-up-tree/s6-rc-up-tree.sh
Normal file
24
pkgs/s6-rc-up-tree/s6-rc-up-tree.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
service=$1
|
||||
|
||||
blocks=""
|
||||
for controlled in $(cd /run/services/controlled/ && echo *); do
|
||||
down=$(s6-rc -un0 change $controlled)
|
||||
echo $controlled $down
|
||||
if test -n "$down"; then
|
||||
blocks="$blocks $controlled "
|
||||
fi
|
||||
done
|
||||
|
||||
for s in $(s6-rc-db -d all-dependencies $service); do
|
||||
for dep in $(s6-rc-db all-dependencies $s); do
|
||||
case "$blocks" in
|
||||
"* $dep *")
|
||||
echo "not starting $s, blocked by $dep"
|
||||
;;
|
||||
*)
|
||||
echo "starting $s because $service"
|
||||
s6-rc -u change $s
|
||||
;;
|
||||
esac
|
||||
done
|
||||
done
|
Reference in New Issue
Block a user