Created
October 19, 2010 23:25
-
-
Save skaurus/635395 to your computer and use it in GitHub Desktop.
buggy mojo init.d
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 | |
# | |
# around Startup script for the around web application | |
# | |
# chkconfig: 35 85 15 | |
# description: around | |
# pidfile: /var/run/around.pid | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
appname=around | |
#listen=http://*:3000 | |
socket="/tmp/$appname.sock" | |
listen="file://$socket" | |
appdir=/var/$appname/ | |
prog="${appdir}script/$appname" | |
options="daemon_prefork --daemonize --reload --user nginx --servers 40 --start 30 --clients 1" | |
pidfile=${PIDFILE-/var/run/$appname.pid} | |
lockfile=${LOCKFILE-/var/lock/subsys/$appname} | |
RETVAL=0 | |
start() { | |
echo -n $"Starting $appname: " | |
daemon $prog $options --pid $pidfile --listen $listen | |
RETVAL=$? | |
echo | |
[ $RETVAL = 0 ] && touch ${lockfile} | |
return $RETVAL | |
} | |
stop() { | |
echo -n $"Stopping $prog: " | |
killproc -p ${pidfile} -d 5 | |
RETVAL=$? | |
# hack: rm -f $socket | |
echo | |
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} ${socket} | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
status) | |
status -p $pidfile | |
RETVAL=$? | |
;; | |
*) | |
echo $"Usage: $prog {start|stop|restart|status}" | |
exit 1 | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment