1 |
stephdl |
1.1 |
#!/bin/sh |
2 |
|
|
|
3 |
|
|
[ -z $SV_TIMEOUT ] && export SV_TIMEOUT=300 |
4 |
|
|
|
5 |
|
|
# Check if this service is already down; avoids useless recursion |
6 |
|
|
svisdown $1 && exit 0 |
7 |
|
|
|
8 |
|
|
if [ -d $1/downdeps ]; then |
9 |
|
|
# We have dependencies to check |
10 |
|
|
|
11 |
|
|
for DEPENDENCY in $1/downdeps/*; do |
12 |
|
|
# start svdown in background so they will run in parallel |
13 |
|
|
svdown $DEPENDENCY & |
14 |
|
|
done |
15 |
|
|
|
16 |
|
|
# Wait for all services to be down |
17 |
|
|
svwaitdown -n -t $SV_TIMEOUT $1/downdeps/* || exit 111 |
18 |
|
|
fi |
19 |
|
|
|
20 |
|
|
# actually stop the service |
21 |
|
|
svc -d $1 || exit 111 |
22 |
|
|
|
23 |
|
|
exit 0 |
24 |
|
|
|