summaryrefslogtreecommitdiff
blob: 132b71098d0acd44a863eed15c8f8f61d28302bb (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

opts="${opts} 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
}