File uwsgi.init of Package uwsgi

#!/bin/sh
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# Author: James Oakley
#
# /etc/init.d/uwsgi
#   and its symbolic link
# /(usr/)sbin/rcuwsgi
#
# LSB compatible service control script; see http://www.linuxbase.org/spec/
#
### BEGIN INIT INFO
# Provides:          uwsgi
# Required-Start:    $syslog $remote_fs
# Should-Start:      $time ypbind smtp
# Required-Stop:     $syslog $remote_fs
# Should-Stop:       ypbind smtp
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: Application Container Server for Networked/Clustered Web Applications
# Description:       Application Container Server for Networked/Clustered Web Applications
### END INIT INFO

# Check for missing binaries (stale symlinks should not happen)
UWSGI_BIN=/usr/sbin/uwsgi
test -x $UWSGI_BIN || { echo "$UWSGI_BIN not installed"; 
	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

UWSGI_CONFIG=/etc/sysconfig/uwsgi
test -r $UWSGI_CONFIG || { echo "$UWSGI_CONFIG not existing";
	if [ "$1" = "stop" ]; then exit 0;
	else exit 6; fi; }
. $UWSGI_CONFIG

UWSGI_OPTIONS="$UWSGI_OPTIONS --autoload"

if [ "$UWSGI_EMPEROR_MODE" = "true" ] ; then
    UWSGI_OPTIONS="$UWSGI_OPTIONS --emperor $UWSGI_VASSALS"
fi

. /etc/rc.status

rc_reset

case "$1" in
    start)
	echo -n "Starting uWSGI "
	/sbin/startproc $UWSGI_BIN $UWSGI_OPTIONS
	rc_status -v
	;;
    stop)
	echo -n "Shutting down uWSGI "
	/sbin/killproc $UWSGI_BIN
	rc_status -v
	;;
    try-restart|condrestart)
	if test "$1" = "condrestart"; then
		echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
	fi
	$0 status
	if test $? = 0; then
		$0 restart
	else
		rc_reset
	fi
	rc_status
	;;
    restart)
	$0 stop
	$0 start
	rc_status
	;;
    force-reload)
	echo -n "Reload service uWSGI "
	/sbin/killproc -HUP $UWSGI_BIN
	rc_status -v
	;;
    reload)
	echo -n "Reload service uWSGI "
	/sbin/killproc -HUP $UWSGI_BIN
	rc_status -v
	;;
    status)
	echo -n "Checking for service uWSGI "
	/sbin/checkproc $UWSGI_BIN
	rc_status -v
	;;
    probe)
	echo -n "uWSGI does not support probe "
	rc_failed 3
	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
rc_exit
openSUSE Build Service is sponsored by