Linux

b07c71d4 :Anonymous 2011-08-18 14:19
start-stop-daemon を使用したsakuの起動スクリプト。
USERやパスなどは適時変更してください。


#!/bin/sh
### BEGIN INIT INFO
# Provides: saku
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop the SAKU server
### END INIT INFO

#
# start/stop SAKU server.
# 2011-08-16-(Tue) 14:54:04 JST
# by yama

set -e

PATH=/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin


USER=shingetu
COMMAND=/usr/local/bin/saku
PIDDIR=/var/run
PIDFILE=$PIDDIR/saku.pid

test -x $COMMAND || exit 0


case "$1" in
start)
echo -n "Starting p2p bbs: saku"
start-stop-daemon --start --pidfile $PIDFILE --make-pidfile --background \
--exec $COMMAND --user $USER --chuid $USER --group $USER
echo "."
;;
stop)
echo -n "Stopping p2p bbs: saku"
setsid start-stop-daemon --stop --oknodo --pidfile $PIDFILE
echo "."
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}"
exit 1
;;
esac

exit 0
Powered by shinGETsu.