updated on Wed Jan 25 08:34:36 UTC 2012
[aur-mirror.git] / tokyotyrant / tokyotyrant.rc
blobeaecb0af049b90e12926d2b294d0854ca7f0e608
1 #!/bin/bash
3 # source config
4 [ -f /etc/conf.d/ttserver ] && . /etc/conf.d/ttserver
6 . /etc/rc.conf
7 . /etc/rc.d/functions
9 case "$1" in
10 start)
11 stat_busy "Starting TokyoTyrant Server"
12 /usr/bin/ttserver ${TYRANT_EXTRA_OPTS} -dmn -pid ${TYRANT_PID_FILE} -log ${TYRANT_LOG_FILE} -port ${TYRANT_PORT} ${TYRANT_DB}
13 if [ $? -gt 0 ]; then
14 stat_fail
15 else
16 add_daemon ttserver
17 stat_done
20 stop)
21 stat_busy "Stopping TokyoTyrant Server"
22 if [ -f $TYRANT_PID_FILE ]; then
23 pid=`cat "$TYRANT_PID_FILE"`
24 kill -TERM "$pid"
25 if [ $? -gt 0 ]; then
26 stat_fail
27 else
28 rm_daemon ttserver
29 stat_done
33 restart)
34 $0 stop
35 sleep 1
36 $0 start
39 echo "usage: $0 {start|stop|restart}"
40 esac
41 exit 0