summaryrefslogtreecommitdiff
blob: edcc946ed4c437032dda725895b47df829969e8b (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
#!/sbin/runscript

extra_commands="configtest reload"

depend() {
	need net
}

start() {
	configtest || return 1
	ebegin "Starting tokyo tyrant"
	start-stop-daemon --start --exec /usr/bin/ttserver -- \
		-pid ${TT_PID} -dmn -host ${TT_HOST} -log ${TT_LOG} \
		-port ${TT_PORT} ${TT_OPTS} ${TT_DB}
	eend $? "Failed to start tokyo tyrant"
}

stop() {
	configtest || return 1
	ebegin "Stopping tokyo tyrant"
	start-stop-daemon --stop --pidfile ${TT_PID}
	eend $? "Failed to stop tokyo tyrant"
	rm -f ${TT_PID}
}

reload() {
	configtest || return 1
	ebegin "Gracefully restarting tokyo tyrant"
	kill -HUP `cat ${TT_PID}` &>/dev/null
	eend $? "Failed to reload tokyo tyrant"
}

configtest() {
	if [ -z "${TT_DB}" ] || [ -z "${TT_PORT}" ] ; then
		eerror "Please check your configuration"
		eend $?
	fi
}