#!/bin/sh
# This file is managed by puppet class 'uwsgi'
#
# uWSGI Emperor process init.d script
#
# chkconfig: - 85 15
# description: uWSGI Emperor process init.d script

### BEGIN INIT INFO
# Provides: uwsgi
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop uwsgi
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

OPTIONS="--daemonize --die-on-term --ini <%= @config_file %>"

[ -f /etc/sysconfig/uwsgi ] && . /etc/sysconfig/uwsgi

RETVAL=0
prog=uwsgi
lockfile=/var/lock/subsys/$prog

start() {
	[ "$EUID" != "0" ] && exit 4

	# Start daemons.
	echo -n $"Starting $prog: "
	daemon $prog $OPTIONS
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch $lockfile
	return $RETVAL
}	

stop() {
	[ "$EUID" != "0" ] && exit 4

	echo -n $"Shutting down $prog: "
	killproc $prog
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f $lockfile
	return $RETVAL
}

reload() {
	[ "$EUID" != "0" ] && exit 4

	echo -n $"Reloading $prog: "
	killproc $prog -HUP
	RETVAL=$?
	echo
	return $RETVAL
}

case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    status)
	status $prog
	;;
    restart)
    	stop
	start
	;;
    reload)
	reload
	;;
    *)
	echo $"Usage: $0 {start|stop|status|restart|reload}"
	exit 2
	;;
esac
exit $?

Add an init.d script template
Add an init.d script template
