-
-
Save Songmu/1364512 to your computer and use it in GitHub Desktop.
stone 起動スクリプト(cent os)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# /etc/init.d/stone として保存する。 | |
# 設定ファイルは /etc/stone.conf | |
# chkconfig: 345 98 02 | |
# description: stone | |
. /etc/rc.d/init.d/functions | |
if [ -f /etc/sysconfig/stone ]; then | |
. /etc/sysconfig/stone | |
fi | |
prog="stone" | |
pidfile=${PIDFILE-/var/run/stone.pid} | |
lockfile=${LOCKFILE-/var/lock/subsys/stone} | |
stone=${STONE-/usr/local/bin/stone} | |
conffile=/etc/stone.conf | |
start() { | |
if [ `whoami` != 'root' ]; then | |
echo root only | |
RETVAL=1 | |
failure; | |
return $RETVAL | |
fi | |
echo -n $"Starting $prog: " | |
daemon $stone -l -D -i $pidfile -C $conffile | |
RETVAL=$? | |
if [ $RETVAL -ne 0 ]; then | |
failure; | |
fi; | |
echo | |
[ $RETVAL = 0 ] && touch ${lockfile} | |
return $RETVAL | |
} | |
stop() { | |
echo -n $"Stopping $prog: " | |
if [ -f $pidfile ]; then | |
killproc -p ${pidfile} $stone | |
RETVAL=$? | |
if [ $RETVAL -ne 0 ]; then | |
failure; | |
fi; | |
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} | |
else | |
echo no pid $pidfile | |
RETVAL=1 | |
failure; | |
fi | |
echo | |
return $RETVAL | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart}" | |
exit 1 | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment