5 # $DragonFly: src/sbin/rcrun/rcrun.sh,v 1.9 2008/07/21 23:42:02 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 dependency, 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 | grep = | sed -e 's/\\$//g' | sed -e 's/=.*//g'`
144 cp /etc
/rc.conf
/etc
/rc.conf.bak
145 if [ $arg = disable
]; then
149 rm -f /etc
/rc.conf.$$
150 ( egrep -v "# rcrun enable ${k}$" /etc/rc.conf; printf "${k}=${mode}\t# rcrun enable ${k}\n" ) > /etc
/rc.conf.$$
151 mv -f /etc
/rc.conf.$$
/etc
/rc.conf
152 echo "added/modified: ${k}=${mode}"
154 if [ $arg = enable ]; then
162 j
=`rcorder -o $i /etc/rc.d/* | tail -1`
164 echo "Unable to find provider id $i"
166 (cd /etc
/rc.d
; sh
$j rcvar
)
171 if [ "X$*" = X
]; then
172 for i
in `varsym -a -s | egrep '^rcng_'`; do
177 varsym
-s rcng_
$i 2>/dev
/null || varsym
-s rcng_
$i
182 echo "usage: rcrun start|stop|restart|rcvar|list|forcestart|faststart|disable|enable"