blob: 1e641194f045283eb60ec58664a1407699e0988a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
usage() {
cat >&2 << EOF
usage: rc action daemon ...
e.g: rc list
rc help
rc start sshd gpm
EOF
exit 1
}
(( $# < 1 )) && usage
declare -i ret=0
case $1 in
help)
usage
;;
list)
cd /etc/rc.d/
for d in *; do
have_daemon "$d" || continue
# print running / stopped satus
if ! ck_daemon "$d"; then
printf "${C_OTHER}[${C_DONE}STARTED${C_OTHER}]"
else
printf "${C_OTHER}[${C_FAIL}STOPPED${C_OTHER}]"
fi
# print auto / manual status
if ! ck_autostart "$d"; then
printf "${C_OTHER}[${C_DONE}AUTO${C_OTHER}]"
else
printf "${C_OTHER}[${C_FAIL} ${C_OTHER}]"
fi
printf " ${C_MAIN}$d${C_CLEAR}\n"
done
;;
*)
action=$1
shift
for i; do
[[ -x "/etc/rc.d/$i" ]] && "/etc/rc.d/$i" $action
(( ret += $? ))
done
esac
exit $ret
# vim: set ts=2 sw=2 noet:
|