I am using supervisord to manage a bunch of processes. Is it possible to use supervisorctl to send arbitrary signals to these processes without actually stopping them and setting stopsignal?
To start supervisord, run $BINDIR/supervisord. The resulting process will daemonize itself and detach from the terminal. It keeps an operations log at $CWD/supervisor. log by default.
Supervisord or Supervisor daemon is an open source process management system. In a nutshell: if a process crashes for any reason, Supervisor restarts it. From the Supervisord website: Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.
Finally, you can exit supervisorctl with Ctrl+C or by entering quit into the prompt: supervisor> quit.
To be able to run any subprocess as a different user from what supervisord is running as, you must run supervisord as root. It tells you if you run multiple subprocesses, you have to run as a root to be able to start all the subprocesses, meaning that if you have more than 2 projects in you supervisord.
Until 3.2.0 (released November 2015), supervisorctl
had no support for sending arbitrary signals to the processes it manages.
From 3.2.0 onwards, use supervisorctl signal
:
signal <signal name> <name> Signal a process
signal <signal name> <gname>:* Signal all processes in a group
signal <signal name> <name> <name> Signal multiple processes or groups
signal <signal name> all Signal all processes
so
supervisorctl signal HUP all
would send SIGHUP
to all processes managed by supervisor.
Until 3.2.0, you instead could use supervisorctl status
to list the pid
s of the managed processes. Then use kill
to send signals to those pid
s. With a little sed
magic, you can even extract those pid
s to be acceptable as input to the kill
command:
kill -HUP `bin/supervisorctl status | sed -n '/RUNNING/s/.*pid \([[:digit:]]\+\).*/\1/p'`
would also send SIGHUP
to all active processes under supervisord
control.
As of 3.2.0, you CAN now send arbitrary signals to processes!
$ supervisord --version
3.2.0
$ supervisorctl signal help
Error: signal requires a signal name and a process name
signal <signal name> <name> Signal a process
signal <signal name> <gname>:* Signal all processes in a group
signal <signal name> <name> <name> Signal multiple processes or groups
signal <signal name> all Signal all processes
$ supervisorctl signal HUP gateway
gateway: signalled
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With