aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/supervisor/README6
-rw-r--r--system/supervisor/doinst.sh18
-rw-r--r--system/supervisor/rc.supervisord107
-rw-r--r--system/supervisor/supervisor.SlackBuild38
-rw-r--r--system/supervisor/supervisor.info12
-rw-r--r--system/supervisor/supervisord.conf162
6 files changed, 232 insertions, 111 deletions
diff --git a/system/supervisor/README b/system/supervisor/README
index db29c43dc4..6aaef46098 100644
--- a/system/supervisor/README
+++ b/system/supervisor/README
@@ -6,3 +6,9 @@ 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.
+
+**ADVICE**
+
+Consider configuring your programs via `/etc/supervisor.d`. In this
+way, `/etc/supervisord.conf` will remain the same and independent of
+the configuration of the programs you want to control.
diff --git a/system/supervisor/doinst.sh b/system/supervisor/doinst.sh
index b0b5ad409c..45a411365c 100644
--- a/system/supervisor/doinst.sh
+++ b/system/supervisor/doinst.sh
@@ -1,13 +1,23 @@
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
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
rm $NEW
fi
- # Otherwise, we leave the .new copy for the admin to consider...
}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
config etc/supervisord.conf.new
+preserve_perms etc/rc.d/rc.supervisord.new
diff --git a/system/supervisor/rc.supervisord b/system/supervisor/rc.supervisord
index 0bff1cca27..d2cbb973f5 100644
--- a/system/supervisor/rc.supervisord
+++ b/system/supervisor/rc.supervisord
@@ -1,103 +1,48 @@
-#!/bin/sh
-# /etc/rc.d/rc.supervisord
-#
-# AUTHOR: Josh Jaques <jjaques@gmail.com>
-#
-# Start/stop/restart supervisor in slackware.
-#
-# To make Supervisor start automatically at boot, make this
-# file executable: chmod 755 /etc/rc.d/rc.supervisord
+#!/bin/bash
-# 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()
+run_supervisord()
{
- $DAEMON -c $CONFIG -j $PIDFILE
+ /usr/bin/supervisord -c /etc/supervisord.conf "${@}"
}
-
-supervisord_status()
+run_supervisorctl()
{
- 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
+ /usr/bin/supervisorctl -c /etc/supervisord.conf "${@}"
}
+supervisord_start()
+{
+ echo "Starting supervisord..."
+ run_supervisord
+}
supervisord_stop()
{
- kill $(cat $PIDFILE)
+ echo "Stopping supervisord..."
+ run_supervisorctl shutdown
}
-case "$1" in
- 'start')
- echo -n "Starting..."
- supervisord_start
- sleep $STARTUP_TIME
- supervisord_status && echo "DONE [PID: $(cat $PIDFILE)]" || echo "ERROR"
- ;;
+supervisord_restart()
+{
+ echo "Restarting supervisord..."
+ run_supervisorctl reload
+}
- 'status')
- supervisord_status && echo "RUNNING [PID: $(cat $PIDFILE)]" || echo "STOPPED"
+case "${1}" in
+ start)
+ supervisord_start
;;
-
- 'stop')
- supervisord_status && {
- echo -n "Stopping $(cat $PIDFILE)..."
- supervisord_stop
- sleep $SHUTDOWN_TIME
- supervisord_status && echo "Failed" || echo "Success"
- } || {
- echo "Not Running..."
- exit 1
- }
+ stop)
+ supervisord_stop
;;
- '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"
+ restart)
+ supervisord_restart
;;
*)
- echo "Usage: $0 {start|stop|restart|status}"
+ echo "Usage: ${0} {start|stop|restart}"
+ exit 1
;;
esac
diff --git a/system/supervisor/supervisor.SlackBuild b/system/supervisor/supervisor.SlackBuild
index 3769f38f42..ae1c459ff3 100644
--- a/system/supervisor/supervisor.SlackBuild
+++ b/system/supervisor/supervisor.SlackBuild
@@ -1,5 +1,6 @@
#!/bin/bash
+# Copyright 2025 Andrzej Telszewski, Koszalin
# Copyright 2014-2018 digwtx <wtx358@qq.com>
# All rights reserved.
#
@@ -23,13 +24,11 @@
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=supervisor
-VERSION=${VERSION:-3.3.4}
+VERSION=${VERSION:-4.2.5}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
-SRCNAM=supervisor
-
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
@@ -52,31 +51,30 @@ 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
+
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$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 {} \;
+chmod -R a-st,u+rwX,go-w+rX .
-rm -f setuptools/*.exe
+python3 setup.py install --root=$PKG
-mkdir -p $PKG/etc
-cat $PRGNAM/skel/sample.conf > $PKG/etc/supervisord.conf.new
+# NOTE:
+#
+# Some files and ideas come from Arch:
+# https://gitlab.archlinux.org/archlinux/packaging/packages/supervisor/
-python2 setup.py install --root=$PKG
+install -D -m 0600 $CWD/supervisord.conf $PKG/etc/supervisord.conf.new
+mkdir -p $PKG/etc/supervisor.d
+install -D -m 0644 $CWD/rc.supervisord $PKG/etc/rc.d/rc.supervisord.new
+mkdir -p $PKG/var/log/supervisor
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 {} \;
+cp -a {CHANGES,README}.rst {COPYRIGHT,LICENSES}.txt $PKG/usr/doc/$PRGNAM-$VERSION
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
diff --git a/system/supervisor/supervisor.info b/system/supervisor/supervisor.info
index d6766ef052..af874d60a1 100644
--- a/system/supervisor/supervisor.info
+++ b/system/supervisor/supervisor.info
@@ -1,10 +1,10 @@
PRGNAM="supervisor"
-VERSION="3.3.4"
+VERSION="4.2.5"
HOMEPAGE="http://supervisord.org/"
-DOWNLOAD="https://pypi.python.org/packages/44/60/698e54b4a4a9b956b2d709b4b7b676119c833d811d53ee2500f1b5e96dc3/supervisor-3.3.4.tar.gz"
-MD5SUM="f1814d71d820ddfa8c86d46a72314cec"
+DOWNLOAD="https://files.pythonhosted.org/packages/ce/37/517989b05849dd6eaa76c148f24517544704895830a50289cbbf53c7efb9/supervisor-4.2.5.tar.gz"
+MD5SUM="db66e6fd57bff1a184db3c07d06d0da5"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
-REQUIRES="python-meld3"
-MAINTAINER="digwtx"
-EMAIL="wtx358@qq.com"
+REQUIRES=""
+MAINTAINER="Andrzej Telszewski"
+EMAIL="andrzej@telszewski.com"
diff --git a/system/supervisor/supervisord.conf b/system/supervisor/supervisord.conf
new file mode 100644
index 0000000000..e81487f3e0
--- /dev/null
+++ b/system/supervisor/supervisord.conf
@@ -0,0 +1,162 @@
+; Supervisor config file.
+;
+; For more information on the config file, please see:
+; http://supervisord.org/configuration.html
+;
+; Notes:
+; - Shell expansion ("~" or "$HOME") is not supported. Environment
+; variables can be expanded using this syntax: "%(ENV_HOME)s".
+; - Quotes around values are not supported, except in the case of
+; the environment= options as shown below.
+; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
+; - Command will be truncated if it looks like a config file comment, e.g.
+; "command=bash -c 'foo ; bar'" will truncate to "command=bash -c 'foo ".
+
+[unix_http_server]
+file=/run/supervisor.sock ; the path to the socket file
+;chmod=0700 ; socket file mode (default 0700)
+;chown=nobody:nogroup ; socket file uid:gid owner
+;username=user ; default is no username (open server)
+;password=123 ; default is no password (open server)
+
+; Security Warning:
+; The inet HTTP server is not enabled by default. The inet HTTP server is
+; enabled by uncommenting the [inet_http_server] section below. The inet
+; HTTP server is intended for use within a trusted environment only. It
+; should only be bound to localhost or only accessible from within an
+; isolated, trusted network. The inet HTTP server does not support any
+; form of encryption. The inet HTTP server does not use authentication
+; by default (see the username= and password= options to add authentication).
+; Never expose the inet HTTP server to the public internet.
+
+;[inet_http_server] ; inet (TCP) server disabled by default
+;port=127.0.0.1:9001 ; ip_address:port specifier, *:port for all iface
+;username=user ; default is no username (open server)
+;password=123 ; default is no password (open server)
+
+[supervisord]
+logfile=/var/log/supervisord.log ; main log file; default $CWD/supervisord.log
+;logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB
+;logfile_backups=10 ; # of main logfile backups; 0 means none, default 10
+;loglevel=info ; log level; default info; others: debug,warn,trace
+pidfile=/run/supervisord.pid ; supervisord pidfile; default supervisord.pid
+;umask=022 ; process file creation umask; default 022
+;nodaemon=false ; start in foreground if true; default false
+;silent=false ; no logs to stdout if true; default false
+;minfds=1024 ; min. avail startup file descriptors; default 1024
+;minprocs=200 ; min. avail process descriptors; default 200
+nocleanup=true ; don't clean up tempfiles at start; default false
+childlogdir=/var/log/supervisor ; 'AUTO' child log dir, default $TEMP
+;user=supervisord ; setuid to this UNIX account at startup; recommended if root
+directory=/ ; default is not to cd during start
+;strip_ansi=false ; strip ansi escape codes in logs; def. false
+;environment=KEY="value" ; key value pairs to add to environment
+;identifier=supervisor ; supervisord identifier, default is 'supervisor'
+
+; The rpcinterface:supervisor section must remain in the config file for
+; RPC (supervisorctl/web interface) to work. Additional interfaces may be
+; added by defining them in separate [rpcinterface:x] sections.
+
+[rpcinterface:supervisor]
+supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
+
+; The supervisorctl section configures how supervisorctl will connect to
+; supervisord. configure it match the settings in either the unix_http_server
+; or inet_http_server section.
+
+[supervisorctl]
+serverurl=unix:///run/supervisor.sock ; use a unix:// URL for a unix socket
+;username=user ; should be same as in [*_http_server] if set
+;password=123 ; should be same as in [*_http_server] if set
+;prompt=supervisor ; cmd line prompt (default "supervisor")
+;history_file=~/.sc_history ; use readline history if available
+
+; The sample program section below shows all possible program subsection values.
+; Create one or more 'real' program: sections to be able to control them under
+; supervisor.
+
+;[program:theprogramname]
+;command=/bin/cat ; the program (relative uses PATH, can take args)
+;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
+;numprocs=1 ; number of processes copies to start (def 1)
+;directory=/tmp ; directory to cwd to before exec (def no cwd)
+;umask=022 ; umask for process (default None)
+;priority=999 ; the relative start priority (default 999)
+;autostart=true ; start at supervisord start (default: true)
+;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
+;startretries=3 ; max # of serial start failures when starting (default 3)
+;autorestart=unexpected ; when to restart if exited after running (def: unexpected)
+;exitcodes=0 ; 'expected' exit codes used with autorestart (default 0)
+;stopsignal=QUIT ; signal used to kill process (default TERM)
+;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
+;stopasgroup=false ; send stop signal to the UNIX process group (default false)
+;killasgroup=false ; SIGKILL the UNIX process group (def false)
+;user=chrism ; setuid to this UNIX account to run the program
+;redirect_stderr=true ; redirect proc stderr to stdout (default false)
+;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
+;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
+;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
+;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
+;stdout_events_enabled=false ; emit events on stdout writes (default false)
+;stdout_syslog=false ; send stdout to syslog with process name (default false)
+;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
+;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
+;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, default 10)
+;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
+;stderr_events_enabled=false ; emit events on stderr writes (default false)
+;stderr_syslog=false ; send stderr to syslog with process name (default false)
+;environment=A="1",B="2" ; process environment additions (def no adds)
+;serverurl=AUTO ; override serverurl computation (childutils)
+
+; The sample eventlistener section below shows all possible eventlistener
+; subsection values. Create one or more 'real' eventlistener: sections to be
+; able to handle event notifications sent by supervisord.
+
+;[eventlistener:theeventlistenername]
+;command=/bin/eventlistener ; the program (relative uses PATH, can take args)
+;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
+;numprocs=1 ; number of processes copies to start (def 1)
+;events=EVENT ; event notif. types to subscribe to (req'd)
+;buffer_size=10 ; event buffer queue size (default 10)
+;directory=/tmp ; directory to cwd to before exec (def no cwd)
+;umask=022 ; umask for process (default None)
+;priority=-1 ; the relative start priority (default -1)
+;autostart=true ; start at supervisord start (default: true)
+;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
+;startretries=3 ; max # of serial start failures when starting (default 3)
+;autorestart=unexpected ; autorestart if exited after running (def: unexpected)
+;exitcodes=0 ; 'expected' exit codes used with autorestart (default 0)
+;stopsignal=QUIT ; signal used to kill process (default TERM)
+;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
+;stopasgroup=false ; send stop signal to the UNIX process group (default false)
+;killasgroup=false ; SIGKILL the UNIX process group (def false)
+;user=chrism ; setuid to this UNIX account to run the program
+;redirect_stderr=false ; redirect_stderr=true is not allowed for eventlisteners
+;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
+;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
+;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
+;stdout_events_enabled=false ; emit events on stdout writes (default false)
+;stdout_syslog=false ; send stdout to syslog with process name (default false)
+;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
+;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
+;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, default 10)
+;stderr_events_enabled=false ; emit events on stderr writes (default false)
+;stderr_syslog=false ; send stderr to syslog with process name (default false)
+;environment=A="1",B="2" ; process environment additions
+;serverurl=AUTO ; override serverurl computation (childutils)
+
+; The sample group section below shows all possible group values. Create one
+; or more 'real' group: sections to create "heterogeneous" process groups.
+
+;[group:thegroupname]
+;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions
+;priority=999 ; the relative start priority (default 999)
+
+; The [include] section can just contain the "files" setting. This
+; setting can list multiple files (separated by whitespace or
+; newlines). It can also contain wildcards. The filenames are
+; interpreted as relative to this file. Included files *cannot*
+; include files themselves.
+
+[include]
+files = /etc/supervisor.d/*.conf