Skip to content

Instantly share code, notes, and snippets.

@skaurus
Created October 19, 2010 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skaurus/635395 to your computer and use it in GitHub Desktop.
Save skaurus/635395 to your computer and use it in GitHub Desktop.
buggy mojo init.d
#!/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