diff options
Diffstat (limited to 'net-misc/tokyotyrant/files/tokyotyrant.initd')
-rw-r--r-- | net-misc/tokyotyrant/files/tokyotyrant.initd | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/net-misc/tokyotyrant/files/tokyotyrant.initd b/net-misc/tokyotyrant/files/tokyotyrant.initd new file mode 100644 index 000000000000..edcc946ed4c4 --- /dev/null +++ b/net-misc/tokyotyrant/files/tokyotyrant.initd @@ -0,0 +1,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 +} |