Lines 12-20
Link Here
|
12 |
|
12 |
|
13 |
usage() { |
13 |
usage() { |
14 |
cat << FOO |
14 |
cat << FOO |
15 |
usage: rc-update -a|add script runlevel2 [runlevel2...] |
15 |
usage: rc-update -a|add script runlevel1 [runlevel2...] |
16 |
rc-update -d|del script [runlevel1...] |
16 |
rc-update -d|del script [runlevel1...] |
17 |
rc-update -s|show [runlevel1...] |
17 |
rc-update -s|show [runlevel1...] |
|
|
18 |
rc-update -c|current runlevel |
18 |
|
19 |
|
19 |
note: |
20 |
note: |
20 |
After rc-update executes, the script dependency cache is automatically |
21 |
After rc-update executes, the script dependency cache is automatically |
Lines 38-43
Link Here
|
38 |
Show all the available scripts and list at which runlevels they |
39 |
Show all the available scripts and list at which runlevels they |
39 |
will execute. |
40 |
will execute. |
40 |
|
41 |
|
|
|
42 |
rc-update current default |
43 |
Synchornize current running services with the "default" runlevel, |
44 |
creating "default" it is doesn't exist. |
45 |
use without any argument to sync to current runlevel. |
46 |
|
41 |
FOO |
47 |
FOO |
42 |
exit 1 |
48 |
exit 1 |
43 |
} |
49 |
} |
Lines 159-164
Link Here
|
159 |
done |
165 |
done |
160 |
} |
166 |
} |
161 |
|
167 |
|
|
|
168 |
current() { |
169 |
|
170 |
local x= |
171 |
local mylevel= |
172 |
|
173 |
shift |
174 |
if [ $# -eq 0 ] |
175 |
then |
176 |
mylevel=$(cat /var/lib/init.d/softlevel) |
177 |
ewarn "Using current runlevel: ${mylevel}" |
178 |
echo |
179 |
else |
180 |
mylevel=$1 |
181 |
fi |
182 |
|
183 |
if [ ! -e "/etc/runlevels/${mylevel}" ] |
184 |
then |
185 |
einfo Creating runlevel ${mylevel} |
186 |
echo |
187 |
mkdir "/etc/runlevels/${mylevel}" |
188 |
fi |
189 |
|
190 |
# Scan current started services and add them to current runlevel |
191 |
|
192 |
for x in $( cd /var/lib/init.d/started/ ; ls ) |
193 |
do |
194 |
if [ ! -L "/etc/runlevels/${mylevel}/${x}" ] |
195 |
then |
196 |
add shift ${x} ${mylevel} |
197 |
fi |
198 |
done |
199 |
|
200 |
# Scan current runlevel for non-running services, and remove them |
201 |
|
202 |
for x in $( cd /etc/runlevels/${mylevel} ; ls ) |
203 |
do |
204 |
if [ ! -L "/var/lib/init.d/started/${x}" ] |
205 |
then |
206 |
del shift ${x} ${mylevel} |
207 |
fi |
208 |
done |
209 |
|
210 |
} |
211 |
|
162 |
if [ $# -lt 1 ] |
212 |
if [ $# -lt 1 ] |
163 |
then |
213 |
then |
164 |
usage |
214 |
usage |
Lines 177-182
Link Here
|
177 |
show|-s) |
227 |
show|-s) |
178 |
show "$@" |
228 |
show "$@" |
179 |
;; |
229 |
;; |
|
|
230 |
current|-c) |
231 |
current "$@" |
232 |
;; |
180 |
*) |
233 |
*) |
181 |
usage |
234 |
usage |
182 |
exit 1 |
235 |
exit 1 |