blob: 104cc177b52b2a8042d2f34f897e0d62ce0eb1f9 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#!/bin/sh
myscript="$1"
if [ -L $1 ] && [ ! -L "/etc/init.d/${1##*/}" ]; then
myservice=$(readlink "$1")
else
myservice=$1
fi
myservice=`basename ${myservice}`
export SVCNAME=${myservice}
[ "$RC_GOT_FUNCTIONS" ] || . /sbin/functions.sh
# wrapper for busybox killall
killall() {
local flags ka
ka=`which killall`
while [ $# -gt 0 ] ; do
case "$1" in
-*) flags="$flags $1";;
*) flags="$flags `basename $1`"
esac
shift
done
$ka $flags
}
svc_start() {
start
}
svc_stop() {
stop
}
svc_status() {
status
}
restart() {
svc_stop
sleep 1
svc_start
}
usage() {
local i uopts
for i in $opts; do
uopts="$uopts|$i"
done
echo "usage: $myscript start|stop|status|restart$uopts"
exit $1
}
# imported from gentoo
get_bootparam() {
local match="$1"
[ -z "${match}" -o ! -r /proc/cmdline ] && return 1
set -- $(cat /proc/cmdline)
while [ -n "$1" ] ; do
case "$1" in
gentoo=*)
local params="${1##*=}"
local IFS=, x=
for x in ${params} ; do
[ "${x}" = "${match}" ] && return 0
done
;;
esac
shift
done
return 1
}
[ -f "/etc/conf.d/$myservice" ] && . "/etc/conf.d/$myservice"
. "$myscript"
shift
if [[ $# -lt 1 ]] ; then
usage 1
fi
for arg in $* ; do
case "${arg}" in
start)
svc_start
;;
stop)
svc_stop
;;
status)
svc_status
;;
restart)
restart
;;
*)
for opt in $opts ; do
if [ "$arg" = "$opt" ]; then
$arg
fi
done
;;
esac
done
|