[uwsgi] Simple SysV script
Jorge A Gallegos
kad at fedoraproject.org
Fri Feb 27 04:47:49 UTC 2015
commit 6e79929fec46f12c5db24641e08f83797da3c611
Author: Jorge Gallegos <kad at fedoraproject.org>
Date: Thu Feb 26 20:47:32 2015 -0800
Simple SysV script
uwsgi.init | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
---
diff --git a/uwsgi.init b/uwsgi.init
new file mode 100644
index 0000000..05c8a68
--- /dev/null
+++ b/uwsgi.init
@@ -0,0 +1,92 @@
+#!/bin/sh
+#
+# uwsgi - this script starts and stops the uwsgi emperor
+#
+# chkconfig: - 85 15
+# description: Fast, self-healing, application container server
+# processname: uwsgi
+# config: /etc/uwsgi.ini
+# config: /etc/uwsgi.d
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+PROG=/usr/sbin/uwsgi
+OWNER=uwsgi
+NAME=uwsgi
+DESC="Fast, self-healing, application container server"
+DAEMON_OPTS="--ini /etc/uwsgi.ini"
+
+[ -f /etc/sysconfig/uwsgi ] && . /etc/sysconfig/uwsgi
+
+lockfile=/var/lock/subsys/uwsgi
+
+start () {
+ echo -n "Starting $NAME $DESC: "
+ daemon $PROG $DAEMON_OPTS
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && touch $lockfile
+ return $retval
+}
+
+stop () {
+ echo -n "Stopping $NAME $DESC: "
+ # uWSGI docs say INT is a gentler way to stop
+ killproc $PROG -INT
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+reload () {
+ echo "Reloading $NAME"
+ killproc $PROG -HUP
+ RETVAL=$?
+ echo
+}
+
+restart () {
+ stop
+ start
+}
+
+rh_status () {
+ status $PROG
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ rh_status_q || exit 7
+ $1
+ ;;
+ status)
+ rh_status
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|condrestart|try-restart|reload|status}" >&2
+ exit 2
+ ;;
+esac
+exit 0
More information about the scm-commits
mailing list