1 |
#!/bin/sh |
2 |
|
3 |
[ -z $SV_RETRYTIME ] && SV_RETRYTIME=1 |
4 |
[ -z $SV_WAITTIME ] && SV_WAITTIME=1 |
5 |
|
6 |
# Check if this service is already up; avoids useless recursion |
7 |
svisup $1 && exit 0 |
8 |
|
9 |
if [ -d $1/updeps ]; then |
10 |
# We have dependencies to check |
11 |
|
12 |
for DEPENDENCY in $1/updeps/*; do |
13 |
# start svup in background so they will run in parallel |
14 |
svup $DEPENDENCY & |
15 |
done |
16 |
|
17 |
# Wait for all services to be up |
18 |
svwaitup -r $SV_RETRYTIME -s $SV_WAITTIME $1/updeps/* || exit 111 |
19 |
fi |
20 |
|
21 |
# Ensure that a supervisor is running for this service |
22 |
# this is postponed to here in order to get more parallelism on boot =) |
23 |
until svok $1; do sleep $SV_RETRYTIME; done |
24 |
|
25 |
# actually start the service |
26 |
svc -u $1 || exit 111 |
27 |
|
28 |
exit 0 |
29 |
|