#!/bin/bash
#
# myapp-http This starts and stops myapp http
#
# chkconfig: 345 56 50
# description: http server for myapp
#
# pidfile: /var/run/myapp-http.pid
PATH=/sbin:/bin:/usr/bin:/usr/sbin
# Source function library.
. /etc/init.d/functions
# Get config.
test -f /etc/sysconfig/network && . /etc/sysconfig/network
# Check that we are root ... so non-root users stop here
[ `id -u` = 0 ] || exit 1
# Check that networking is up.
[ "${NETWORKING}" = "yes" ] || exit 0
RETVAL=0
STARMAN="/usr/bin/starman"
MYAPP_HOME="/home/myapp/production"
PID_FILE="/var/run/myapp-http.pid"
PORT=8000
HOST=127.0.0.1
STARMAN_OPTS="-D -E deploy --pid $PID_FILE -I$MYAPP_HOME/lib --listen $HOST:$PORT $MYAPP_HOME/app.psgi"
start(){
echo -n $"Starting myapp-http: "
daemon --pidfile $PID_FILE $STARMAN "$STARMAN_OPTS"
RETVAL=$?
echo
touch /var/lock/subsys/myapp-http
return $RETVAL
}
stop(){
echo -n $"Stopping $prog: "
killproc -p $PID_FILE $prog
RETVAL=$?
echo
rm -f /var/lock/subsys/myapp-http
return $RETVAL
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/myapp-http ] && restart
return 0
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p $PID_FILE starman
;;
restart)
restart
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
RETVAL=1
esac
exit $RETVAL
Tuesday, September 7, 2010
RHEL/Centos init script for a starman web application
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment