packages: uwsgi/uwsgi.init (NEW) - init script for uWSGI server (initial co...

brushek brushek at pld-linux.org
Wed Jun 29 00:16:23 CEST 2011


Author: brushek                      Date: Tue Jun 28 22:16:23 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- init script for uWSGI server (initial commit)

---- Files affected:
packages/uwsgi:
   uwsgi.init (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/uwsgi/uwsgi.init
diff -u /dev/null packages/uwsgi/uwsgi.init:1.1
--- /dev/null	Wed Jun 29 00:16:23 2011
+++ packages/uwsgi/uwsgi.init	Wed Jun 29 00:16:18 2011
@@ -0,0 +1,108 @@
+#!/bin/sh
+# /etc/init.d/uwsgi
+#
+# php-fpm	Fast WSGI server
+#
+# chkconfig:	345 80 30
+#
+# description:	Fast WSGI server
+#
+# processname:	uwsgi
+# config:	/etc/uwsgi/uwsgi.xml
+# pidfile:	/var/run/uwsgi/uwsgi.pid
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get uwsgi system config
+. /etc/sysconfig/uwsgi
+
+
+PIDFILE=/var/run/uwsgi/uwsgi.pid
+CONF=/etc/uwsgi/uwsgi.$UWSGI_CONFIG_FORMAT
+
+# Carry out specific functions when asked to by the system
+start() {
+	if [ ! -f /var/lock/subsys/uwsgi ]; then
+		msg_starting "uWSGI"
+		if [ $UWSGI_CONFIG_FORMAT = "xml" ]; then
+        		daemon --pidfile $PIDFILE  /usr/bin/uwsgi -x $CONF
+		elif [ $UWSGI_CONFIG_FORMAT = "ini" ]; then
+        		daemon --pidfile $PIDFILE  /usr/bin/uwsgi --ini $CONF
+		else 
+			echo "Set proper config format in /etc/sysconfig/uwsgi"
+			exit 1
+		fi
+
+		RETVAL=$?
+		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/uwsgi
+	else
+		msg_already_running "uWSGI"
+	fi
+
+}
+stop() {
+	if [ -f /var/lock/subsys/uwsgi ]; then
+		msg_stopping "uWSGI "
+		/sbin/start-stop-daemon -q --stop -s QUIT --retry QUIT/600/TERM/10 --pidfile $PIDFILE
+		[ "$?" -eq 0 ] && ok || fail
+		rm -f /var/lock/subsys/uwsgi
+	else
+		msg_not_running "uWSGI"
+	fi
+}
+ 
+reload() {
+	local sig=${1:-HUP}
+	local retnr=${2:-7}
+
+	if [ -f /var/lock/subsys/uwsgi ]; then
+		msg_reloading "uWSGI"
+		killproc --pidfile $PIDFILE uwsgi -$sig
+		RETVAL=$?
+	else
+		msg_not_running "uWSGI"
+		RETVAL=$retnr
+	fi
+}
+condrestart() {
+	if [ -f /var/lock/subsys/uwsgi ]; then
+		stop
+		start
+	else
+		msg_not_running "uWSGI"
+		RETVAL=$1
+	fi
+}
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop|quit)
+  	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  reload|force-reload)
+	reload HUP 7
+	;;
+  flush-logs|logrotate)
+	reload USR1 0
+	;;
+  status)
+	status uwsgi
+	RETVAL=$?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}"
+	exit 3
+	;;
+esac
+
+exit $RETVAL
================================================================


More information about the pld-cvs-commit mailing list