blob: 705d1e563160d3c37bac8a2538e7ea9e0662c0ac (
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
|
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Author: Cor Cornelisse <corcornelisse@gmail.com>
depend() {
need net
}
opts="reload"
BASENAME=$(echo $SVCNAME | cut -d '-' -f 1)
SERVERNAME=$(echo $SVCNAME | cut -c 7-)
checkconfig() {
if [ ! -r /etc/${BASENAME}/${SERVICENAME} ]; then
eerror "No config file found: /etc/${BASENAME}/${SERVICENAME}"
return 1
fi
return 0
}
start() {
checkconfig || return $?
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --pidfile "/var/run/${BASENAME}/${SERVERNAME}.pid" \
--exec /usr/bin/${BASENAME}-init -- ${SERVERNAME} start
eend $? "Failed to start ${SVCNAME}"
}
stop() {
checkconfig || return $?
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --pidfile "/var/run/${BASENAME}/${SERVERNAME}.pid" \
--exec /usr/bin/${BASENAME}-init -- ${SERVERNAME} stop
eend $? "Failed to stop ${SVCNAME}"
}
reload() {
checkconfig || return $?
ebegin "Reloading ${SVCNAME}"
start-stop-daemon --exec /usr/bin/${BASENAME}-init -- ${SERVERNAME} reload
eend $? "Failed to reload ${SVCNAME}"
}
restart() {
checkconfig || return $?
ebegin "Restarting ${SVCNAME}"
start-stop-daemon --exec /usr/bin/${BASENAME}-init -- ${SERVERNAME} restart
eend $? "Failed to restart ${SVCNAME}"
}
status() {
start-stop-daemon --exec /usr/bin/${BASENAME}-init -- ${SERVERNAME} status
eend $? "Failed to get status for ${SVCNAME}"
}
|