summaryrefslogtreecommitdiff
path: root/system/supervisor
diff options
context:
space:
mode:
authordigwtx <wtx358@qq.com>2014-08-31 18:17:25 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2014-08-31 18:17:25 +0700
commit01c299573cd04fcc3b7612ce8f18459bcf77bf19 (patch)
tree5e75ad79dd7b53283499d37bbbf05f2a9a67ade4 /system/supervisor
parent5a94f78d0a2542e4903b61c9ff7ee833b60fb83b (diff)
downloadslackbuilds-01c299573cd04fcc3b7612ce8f18459bcf77bf19.tar.gz
system/supervisor: Added (A system for controlling process state).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/supervisor')
-rw-r--r--system/supervisor/README8
-rw-r--r--system/supervisor/doinst.sh13
-rw-r--r--system/supervisor/rc.supervisord104
-rw-r--r--system/supervisor/slack-desc19
-rw-r--r--system/supervisor/supervisor.SlackBuild79
-rw-r--r--system/supervisor/supervisor.info10
6 files changed, 233 insertions, 0 deletions
diff --git a/system/supervisor/README b/system/supervisor/README
new file mode 100644
index 0000000000..8b44b13b10
--- /dev/null
+++ b/system/supervisor/README
@@ -0,0 +1,8 @@
+Supervisor is a client/server system that allows its users to monitor
+and control a number of processes on UNIX-like operating systems.
+
+It shares some of the same goals of programs like launchd, daemontools,
+and runit. Unlike some of these programs, it is not meant to be run as a
+substitute for init as “process id 1”. Instead it is meant to be used to
+control processes related to a project or a customer, and is meant to
+start like any other program at boot time.
diff --git a/system/supervisor/doinst.sh b/system/supervisor/doinst.sh
new file mode 100644
index 0000000000..b0b5ad409c
--- /dev/null
+++ b/system/supervisor/doinst.sh
@@ -0,0 +1,13 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redu
+ndant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+config etc/supervisord.conf.new
diff --git a/system/supervisor/rc.supervisord b/system/supervisor/rc.supervisord
new file mode 100644
index 0000000000..1fb7a4d5fe
--- /dev/null
+++ b/system/supervisor/rc.supervisord
@@ -0,0 +1,104 @@
+#!/bin/sh
+# /etc/rc.d/rc.supervisord
+#
+# AUTHOR: Josh Jaques <jjaques@gmail.com>
+#
+# Start/stop/restart supervisor in slackware.
+# Specfically tested in v13.37
+#
+# To make Supervisor start automatically at boot, make this
+# file executable: chmod 755 /etc/rc.d/rc.supervisord
+
+# Time to wait between stop/start on a restart
+SHUTDOWN_TIME=5
+
+# Time to wait after a start before reporting success/fail
+STARTUP_TIME=1
+
+# Location of the pid file
+PIDFILE=/var/run/supervisord.pid
+
+# Config of supervisor
+CONFIG=/etc/supervisord.conf
+
+# Daemon to start
+DAEMON=supervisord
+
+supervisord_start()
+{
+ $DAEMON -c $CONFIG -j $PIDFILE
+}
+
+
+supervisord_status()
+{
+ if [ -f $PIDFILE ]
+ then
+ pgrep $DAEMON | grep -f $PIDFILE > /dev/null 2>/dev/null
+ if [ $? -eq 0 ]
+ then
+ return 0
+ else
+ return 1
+ fi
+ else
+ return 1
+ fi
+}
+
+
+supervisord_stop()
+{
+ kill $(cat $PIDFILE)
+}
+
+case "$1" in
+ 'start')
+ echo -n "Starting..."
+ supervisord_start
+ sleep $STARTUP_TIME
+ supervisord_status && echo "DONE [PID: $(cat $PIDFILE)]" || echo "ERROR"
+ ;;
+
+ 'status')
+ supervisord_status && echo "RUNNING [PID: $(cat $PIDFILE)]" || echo "STOPPED"
+ ;;
+
+
+ 'stop')
+ supervisord_status && {
+ echo -n "Stopping $(cat $PIDFILE)..."
+ supervisord_stop
+ sleep $SHUTDOWN_TIME
+ supervisord_status && echo "Failed" || echo "Success"
+ } || {
+ echo "Not Running..."
+ exit 1
+ }
+ ;;
+
+ 'restart')
+ supervisord_status && {
+ echo -n "Stopping $(cat $PIDFILE)..."
+ supervisord_stop
+ sleep $SHUTDOWN_TIME
+ supervisord_status && {
+ echo "Failed"
+ exit 1
+ } || {
+ echo "Success"
+ }
+ } || {
+ echo "Not Running..."
+ exit 1
+ }
+ echo -n "Starting..."
+ supervisord_start
+ sleep $STARTUP_TIME
+ supervisord_status && echo "DONE [PID: $(cat $PIDFILE)]" || echo "ERROR"
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ ;;
+esac
diff --git a/system/supervisor/slack-desc b/system/supervisor/slack-desc
new file mode 100644
index 0000000000..2bdae65c4a
--- /dev/null
+++ b/system/supervisor/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+supervisor: supervisor (A system for controlling process state under UNIX)
+supervisor:
+supervisor: Supervisor is a client/server system that allows its users to
+supervisor: monitor and control a number of processes on UNIX-like operating
+supervisor: systems.
+supervisor:
+supervisor: It shares some of the same goals of programs like launchd,
+supervisor: daemontools, and runit.
+supervisor:
+supervisor: Homepage: http://supervisord.org/
+supervisor:
diff --git a/system/supervisor/supervisor.SlackBuild b/system/supervisor/supervisor.SlackBuild
new file mode 100644
index 0000000000..b8a686b88b
--- /dev/null
+++ b/system/supervisor/supervisor.SlackBuild
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# Copyright 2014 digwtx <wtx358@qq.com>
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=supervisor
+VERSION=${VERSION:-3.1.1}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+SRCNAM=supervisor
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=${PKG:-$TMP/package-$SRCNAM}
+OUTPUT=${OUTPUT:-/tmp}
+
+set -eu
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $SRCNAM-$VERSION
+tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
+cd $SRCNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+rm -f setuptools/*.exe
+
+mkdir -p $PKG/etc
+cat $PRGNAM/skel/sample.conf > $PKG/etc/supervisord.conf.new
+
+python setup.py install --root=$PKG
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a *.txt $PKG/usr/doc/$PRGNAM-$VERSION
+find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 0644 {} \;
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/etc/rc.d
+cat $CWD/rc.supervisord > $PKG/etc/rc.d/rc.supervisord
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
+
diff --git a/system/supervisor/supervisor.info b/system/supervisor/supervisor.info
new file mode 100644
index 0000000000..a303a3e500
--- /dev/null
+++ b/system/supervisor/supervisor.info
@@ -0,0 +1,10 @@
+PRGNAM="supervisor"
+VERSION="3.1.1"
+HOMEPAGE="http://supervisord.org/"
+DOWNLOAD="https://pypi.python.org/packages/source/s/supervisor/supervisor-3.1.1.tar.gz"
+MD5SUM="8c9714feaa63902f03871317e3ebf62e"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="pysetuptools"
+MAINTAINER="digwtx"
+EMAIL="wtx358@qq.com"