5 # $DragonFly: src/sbin/rcrun/rcrun.sh,v 1.6 2005/12/20 15:25:45 swildner Exp $
13 case X
`varsym -s -q rcng_$i` in
15 echo "$i has already been started"
18 echo "$i has already been configured"
22 for j
in `rcorder -o $i /etc/rc.d/*`; do
24 for k
in `rcorder -p $j`; do
28 state
=`varsym -s -q rcng_$k`
30 Xrunning
*|Xconfigured
*|Xirrelevant
*|Xdisabled
*)
33 echo "$i depends on $k, current state: $state"
40 # $j contains the last dependancy, which we run
43 echo "Unable to find keyword $i"
44 elif [ $_return = 0 ]; then
45 echo "Running $j $arg"
46 (cd /etc
/rc.d
; sh
$j $arg)
47 case X
`varsym -s -q rcng_$i` in
49 echo "$i is disabled, enable in rc.conf first or use rcforce"
52 echo "$i has failed to start"
105 dostart forcestart $@
112 j
=`rcorder -o $i /etc/rc.d/* | tail -1`
114 echo "Unable to find keyword $i"
116 (cd /etc
/rc.d
; sh
$j stop
)
122 j
=`rcorder -o $i /etc/rc.d/* | tail -1`
124 echo "Unable to find keyword $i"
126 (cd /etc
/rc.d
; sh
$j restart
)
131 if [ "$arg" = "enable" ]; then
137 j
=`rcorder -o $i /etc/rc.d/* | tail -1`
139 echo "Unable to find provider id $i"
140 elif [ `varsym -s -q rcng_$i` = "$mode" ]; then
141 echo "$i is already $mode"
143 vars
=`(cd /etc/rc.d; sh $j rcvar) 2>/dev/null | egrep '_enable' | sed -e 's/\\$//g' | sed -e 's/=.*//g'`
144 cp /etc
/rc.conf
/etc
/rc.conf.bak
146 rm -f /etc
/rc.conf.$$
147 ( egrep -v "#rcrun ${k}" /etc/rc.conf; printf "${k}=${mode}\t#rcrun ${k}_enable\n" ) > /etc
/rc.conf.$$
148 mv -f /etc
/rc.conf.$$
/etc
/rc.conf
149 echo "added/modified: ${k}=${mode}"
151 if [ $arg = enable ]; then
161 j
=`rcorder -o $i /etc/rc.d/* | tail -1`
163 echo "Unable to find provider id $i"
165 (cd /etc
/rc.d
; sh
$j rcvar
)
171 for i
in `varsym -a -s | egrep '^rcng_'`; do
176 varsym
-s rcng_
$i 2>/dev
/null || varsym
-s rcng_
$i
181 echo "$0 {start|stop|restart|rcvar|list|forcestart|faststart} <rcng_list>"