Supervisor process control system for UNIX

Related tags

supervisor
Overview

Supervisor

Supervisor is a client/server system that allows its users to control a number of processes on UNIX-like operating systems.

Supported Platforms

Supervisor has been tested and is known to run on Linux (Ubuntu), Mac OS X (10.4, 10.5, 10.6), and Solaris (10 for Intel) and FreeBSD 6.1. It will likely work fine on most UNIX systems.

Supervisor will not run at all under any version of Windows.

Supervisor is intended to work on Python 3 version 3.4 or later and on Python 2 version 2.7.

Documentation

You can view the current Supervisor documentation online in HTML format . This is where you should go for detailed installation and configuration documentation.

Reporting Bugs and Viewing the Source Repository

Please report bugs in the GitHub issue tracker.

You can view the source repository for supervisor via https://github.com/Supervisor/supervisor.

Contributing

We'll review contributions from the community in pull requests on GitHub.

Issues
  • Restart signals not supported

    Restart signals not supported

    Hi there. Thanks a lot for supervisor, I am using it on quite a few servers and it is performing greatly.

    I would like to suggest a feature that would be very advantageous (well, at least for me). There are some processes that support receiving a certain signal, such as HUP, causing them to perform a graceful restart.

    Examples for such processes include the HTTP web server Cherokee (http://www.cherokee-project.com) and servers initiated via Perl's Server::Starter (http://search.cpan.org/dist/Server-Starter), which acts as a superdaemon.

    If I could set on supervisord.conf that a certain process is restarted with a HUP signal, just like I can set the signal for stopping a process, then I could just do "restart process_name" and get the correct behaviour. That would be awesome.

    Thanks a lot, Ido Perlmuter.

    signals 
    opened by ido50 95
  • unix:///var/run/supervisor.sock no such file

    unix:///var/run/supervisor.sock no such file

    I don't seem to be able to get supervisor to run! Here are the details:

    [email protected]:/etc/supervisor$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04 LTS Release: 14.04 Codename: trusty [email protected]:/etc/su

    [email protected]:/etc/supervisor$ sudo apt-get install supervisor Reading package lists... Done Building dependency tree
    Reading state information... Done supervisor is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 70 not upgraded.

    [email protected]:/etc/supervisor$ sudo service supervisor restart Restarting supervisor: supervisord.

    [email protected]:/etc/supervisor$ sudo supervisord /usr/lib/python2.7/dist-packages/supervisor/options.py:295: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security. 'Supervisord is running as root and it is searching '

    [email protected]:/etc/supervisor$ sudo supervisorctl unix:///var/run/supervisor.sock no such file supervisor> help

    default commands (type help ):

    add clear fg open quit remove restart start stop update avail exit maintail pid reload reread shutdown status tail version

    supervisor> reread error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib/python2.7/socket.py line: 224

    supervisor> update error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib/python2.7/socket.py line: 224

    Here are some more details:

    [email protected]:/etc/supervisor$ sudo apt-cache show supervisor Package: supervisor Priority: extra Section: universe/admin Installed-Size: 1485 Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Qijiang Fan [email protected] Architecture: all Version: 3.0b2-1 Depends: python, python-meld3, python-pkg-resources (>= 0.6c7) Filename: pool/universe/s/supervisor/supervisor_3.0b2-1_all.deb Size: 313972 MD5sum: 1e5ee03933451a0f4fc9ff391404f292 SHA1: d9dc47366e99e77b6577a9a82abd538c4982c58e SHA256: f83f89a439cc8de5f2a545edbf20506695e4b477c579a5824c063fbaf94127c1 Description-en: A system for controlling process state Supervisor is a system for controlling and maintaining process state, similar to what init does, but not intended as an init replacement. . It will manage individual processes or groups of processes that need to be started and stopped in order, and it is possible to control individual process state via an rpc mechanism, thus allowing ordinary users to restart processes. Description-md5: b18ffbeaa3a697e8ccaee9cc104ec380 Homepage: http://supervisord.org/ Bugs: https://bugs.launchpad.net/ubuntu/+filebug Origin: Ubuntu

    Thanks

    opened by behnampmdg3 78
  • "supervisorctl reload" fails to re-start program

    Running "supervisorctl reload" on a running supervisord instance will cause program to stop and not re-start.

    I've noticed this happening since upgrading from 3.0a10 to 3.0a12. Can provide more information if it's not duplicatable.

    opened by jbrehm 64
  • Python 3 support?

    Python 3 support?

    https://pypi.python.org/pypi/supervisor

    Supervisor is known to work with Python 2.4 or later but will not work under any version of Python 3.

    Vs.

    https://github.com/Supervisor/supervisor/blob/master/setup.py#L58-L61

    https://github.com/Supervisor/supervisor/labels/python%203

    python 3 
    opened by cclauss 62
  • Allow a custom

    Allow a custom "stop-command" to manage graceful shutdown of processes

    I am trying to use supervisord to manage instances of playframework applications. The framework supplies commands for starting and stopping instances which allows an application to properly shutdown and the execution of lifecycle events of plugins. An example is the proper closing of Lucene search index, which cannot be opened again if they are shutdown ungracefully, because a "write-lock" file remains the in index directory.

    What I would consider a great addition, would be the possibility to specify something like this:

    [program:my-play-web-app] command=/opt/play-1.2.5/play start stop-command=/opt/play-1.2.5/play stop directory=/path/to/home-of-play-web-app/

    Is there any means that I can do this with supervisord right now? The only workaround I have found is the following:

    [program:my-play-web-app] command=/path/to//home-of-play-web-app/startup.sh directory=/path/to/home-of-play-web-app/

    With startup.sh being:

    trap "{ echo Stopping play app; /opt/play-1.2.5/play stop; exit 0; }" EXIT echo Starting play app /opt/play-1.2.5/play start

    (taken from here: http://stackoverflow.com/questions/7732371/how-to-properly-manage-rabbitmq-with-supervisord )

    opened by grandfatha 57
  • supervisorctl takes too long to execute command

    supervisorctl takes too long to execute command

    [[email protected]] ~ $ supervisorctl stop XXX ^CTraceback (most recent call last): File "/usr/local/bin/supervisorctl", line 9, in load_entry_point('supervisor==3.0a12', 'console_scripts', 'supervisorctl')() File "/usr/local/lib/python2.6/dist-packages/supervisor/supervisorctl.py", line 1114, in main c.onecmd(" ".join(options.args)) File "/usr/local/lib/python2.6/dist-packages/supervisor/supervisorctl.py", line 144, in onecmd return do_func(arg) File "/usr/local/lib/python2.6/dist-packages/supervisor/supervisorctl.py", line 732, in do_stop result = supervisor.stopProcess(name) File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in call return self.__send(self.__name, args) File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request verbose=self.__verbose File "/usr/local/lib/python2.6/dist-packages/supervisor/xmlrpc.py", line 463, in request r = self.connection.getresponse() File "/usr/lib/python2.6/httplib.py", line 990, in getresponse response.begin() File "/usr/lib/python2.6/httplib.py", line 391, in begin version, status, reason = self._read_status() File "/usr/lib/python2.6/httplib.py", line 349, in _read_status line = self.fp.readline() File "/usr/lib/python2.6/socket.py", line 427, in readline data = recv(1) KeyboardInterrupt

    supervisorctl status show 'STOPPED' and the process does not exists. The log file shows: 2012-06-19 14:31:08,722 INFO stopped: XXX (terminated by SIGTERM)

    I can turn on more debugging if you need

    supervisorctl 
    opened by gilles 43
  • Fix tail -f not working on both supervisorctl and Web interface (ASCII and unicode log)

    Fix tail -f not working on both supervisorctl and Web interface (ASCII and unicode log)

    I wrote a Python script for outputting "%H:%M:%S" each second. Then, I used tail -f function on both supervisorctl and Web interface. Unfortunately it didn't work

    For supervisorctl, it output a data chunk including error message, then stopped:

    supervisor> status
    clock                            RUNNING   pid 21792, uptime 0:15:08
    supervisor> tail -f clock
    ==> Press Ctrl-C to exit <==
    b':29:33\n21:29:34\n21:29:35\n21:29:36\n21:29:37\n21:29:38\n21:29:39\n21:29:40\n21:29:41\n21:29:42\n21:29:43\n21:29:44\n21:29:45\n21:29:46\n21:29:47\n21:29:48\n21:29:49\n21:29:50\n21:29:51\n21:29:52\n21:29:53\n21:29:54\n21:29:55\n21:29:56\n21:29:57\n21:29:58\n21:29:59\n21:30:00\n21:30:01\n21:30:02\n21:30:03\n21:30:04\n21:30:05\n21:30:06\n21:30:07\n21:30:08\n21:30:09\n21:30:10\n21:30:11\n21:30:12\n21:30:13\n21:30:14\n21:30:15\n21:30:16\n21:30:17\n21:30:18\n21:30:19\n21:30:20\n21:30:21\n21:30:22\n21:30:23\n21:30:24\n21:30:25\n21:30:26\n21:30:27\n21:30:28\n21:30:29\n21:30:30\n21:30:31\n21:30:32\n21:30:33\n21:30:34\n21:30:35\n21:30:36\n21:30:37\n21:30:38\n21:30:39\n21:30:40\n21:30:41\n21:30:42\n21:30:43\n21:30:44\n21:30:45\n21:30:46\n21:30:47\n21:30:48\n21:30:49\n21:30:50\n21:30:51\n21:30:52\n21:30:53\n21:30:54\n21:30:55\n21:30:56\n21:30:57\n21:30:58\n21:30:59\n21:31:00\n21:31:01\n21:31:02\n21:31:03\n21:31:04\n21:31:05\n21:31:06\n21:31:07\n21:31:08\n21:31:09\n21:31:10\n21:31:11\n21:31:12\n21:31:13\n21:31:14\n21:3http://127.0.0.1:9001/logtail/clock/stdout Cannot connect, error: <class 'ValueError'> (invalid literal for int() with base 16: "1:15\\n21:31:16\\n21:31:17\\n21:31:18\\n21:31:19\\n21:31:20\\n21:31:21\\n21:31:22\\n21:31:23\\n21:31:24\\n21:31:25\\n21:31:26\\n'")
    supervisor> 
    

    Take a look at the output, you will see the error message:

    http://127.0.0.1:9001/logtail/clock/stdout Cannot connect, error: <class 'ValueError'> (invalid literal for int() with base 16: "1:15\\n21:31:16\\n21:31:17\\n21:31:18\\n21:31:19\\n21:31:20\\n21:31:21\\n21:31:22\\n21:31:23\\n21:31:24\\n21:31:25\\n21:31:26\\n'"
    

    For Web interface, sometimes it behaved same as supervisorctl, sometimes it didn't show any log.

    With this fix, supervisor worked perfectly with Python-2.7.8 and Python-3.4.1

    supervisorctl web python 3 
    opened by ngocson2vn 37
  • exit code allway zero

    exit code allway zero

    I want to use the exit code for nagios but it's allways 0.

    ecample 1: [email protected]:~> ./bin/supervisorctl status http://127.0.0.1:9001 refused connection [email protected]:~> echo $? 0

    Could you change exit LSB conform ? http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

    example 2: ./bin/supervisorctl status balancer RUNNING pid 23753, uptime 0:00:50 instance0 RUNNING pid 23751, uptime 0:00:50 instance1 EXITED Jun 26 05:40 PM varnish RUNNING pid 23754, uptime 0:00:50 zeo RUNNING pid 23750, uptime 0:00:50 [email protected]:~> echo $? 0

    supervisorctl 
    opened by ramary 33
  • Better syslog configuration and output

    Better syslog configuration and output

    Hi there, thanks for the recent rework in the syslog support. This is a set of changes which make the syslog output a bit better, reaching this:

        Sep 19 10:18:46.285916 Herman daemon.notice supervisord[5296]: supervisord started with pid 5296
        Sep 19 10:18:47.288994 Herman daemon.notice supervisord[5296]: spawned: 'vmstat' with pid 5299
        Sep 19 10:18:47.291366 Herman daemon.notice supervisord[5296]: spawned: 'badvmstat' with pid 5300
        Sep 19 10:18:47.297447 Herman   user.info   vmstat: procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
        Sep 19 10:18:47.298812 Herman   user.info   vmstat:  r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
        Sep 19 10:18:47.299112 Herman   user.info   vmstat:  3  0      0 4874284 244368 1695416    0    0    63    20   62  191  1  0 98  1
        Sep 19 10:18:47.299428 Herman   user.notice badvmstat: vmstat: failed to parse argument: '5;'
        Sep 19 10:18:47.299866 Herman daemon.notice supervisord[5296]: exited: badvmstat (exit status 1; not expected)
        Sep 19 10:18:48.298243 Herman   user.info   vmstat:  0  0      0 4863852 244368 1702904    0    0     0     0 1437 8074  4  3 93  0
        Sep 19 10:18:48.298447 Herman daemon.notice supervisord[5296]: success: vmstat entered RUNNING state, process has stayed up for > than 1 seconds (startse
        Sep 19 10:18:49.298594 Herman   user.info   vmstat:  0  0      0 4863528 244368 1703152    0    0     0     0  737 1475  1  1 99  0
          ...
        Sep 19 10:19:13.488894 Herman daemon.warning supervisord[5296]: received SIGINT indicating exit request
    

    Along the lines of the new "stdout_syslog" and "stderr_syslog" boolean values, I have created a new "syslog" top-level configuration, which is configured identically. Additionally, there are now reasonable defaults for syslog facility and priority (shown in the above, but not logged by default by eg rsyslog). Finally, if you care, you can select the syslog channel (192 to choose from!) yourself for each stream by putting the channel there instead of "true" in any of the *syslog config settings.

    Closes issue #162

    logging syslog 
    opened by samv 33
  • Differences between reread, reload, restart, update?

    Differences between reread, reload, restart, update?

    Perhaps I missed it but is there a good explanation anywhere as to the differences between these four commands? I didn't see them discussed in the supervisord online documentation. I've noticed on ServerFault and Stackoverflow that other users don't understand their differences either.

    For example, if I change the configuration in one program section, I know I must do "supervisorctl reread" to have those changes made available. But how do you restart just that one program? supervisorctl restart doesn't work. Instead if appears that you must either run "supervisorctl update" or restart the supervisor daemon itself. However, this seems to have the unintended effect of restarting all programs, not just the one that changed.

    Thanks.

    docs 
    opened by flaugher 32
  • feature: Action button with custom URL

    feature: Action button with custom URL

    This pull request adds an option to add custom action button for each running program in the Supervisor Web Status page. This is useful for example to quickly open a native program/service dashboard if it's available. Both custom_action_name and custom_action_href parameters have to be specified in the program section for custom button to appear.

    opened by Vorticity-Flux 0
  • Access supervisor xrpc interface from other xrpc interface

    Access supervisor xrpc interface from other xrpc interface

    Hi,

    I have a question about about extending supervisord per xrpc plugins.

    Basically what I would like to do is write a restartProcess function which stops and starts a process from within the supervisord process, the idea being that a process managed by supervisord can restart itself using the xrpc interface, so calling stop and start separately over that process won't work. Therefor I would like to access the "supervisor" xrpc interface from my own xrpc plugin.

    Spending some hours looking through the code and the already existing 3rdparty plugins, I found no good way of achieving my goal.

    Ideally I would want something like this function from the controller interface: https://github.com/Supervisor/supervisor/blob/master/supervisor/supervisorctl.py#L246

    So is my Idea of accessing the "main" supervisor xrpc from another xrpc plugin even possible, or are the xrpc classes wrapped in a way that makes calling them manually from the same process impossible?

    I hope I could somewhat understandable describe my issue, nevertheless already thanks for helping me out!

    question 
    opened by manuel2258 0
  • program raised

    program raised "UnicodeDecodeError"

    I have a program that works fine when I start at the terminal,but when I start in Supervisor, it raised "UnicodeDecodeError".

    This is my config.

    [program:slam_realtime]
    killasgroup=true
    stopasgroup=true
    command=/opt/bslam_web/bito_realtime_api/scripts/start_up.sh
    process_name=%(program_name)s
    numprocs=1
    user=slam
    umask=022
    autostart=true
    autorestart=true
    startsecs=10
    startretries=3
    exitcodes=0,2
    stopsignal=INT
    stopwaitsecs=10
    environment=A="1",B="2",LANG="en_US.utf8",LC_ALL="en_US.UTF-8",LC_LANG="en_US.UTF-8"
    serverurl=AUTO
    vacuum=true
    

    When i run /opt/bslam_web/bito_realtime_api/scripts/start_up.sh in terminal,it was all ok!

    The information I can provide is as follows:

    1. Error occurs when open a file which have Chinese characters
    2. python version is 3.5
    3. supervisor version is 3.2.0

    This are some screenshots. image image image

    opened by lastshusheng 0
  • SupervisorNamespaceRPCInterface.getProcessInfo returns old state when called in event handler

    SupervisorNamespaceRPCInterface.getProcessInfo returns old state when called in event handler

    When an rpx extension calls SupervisorNamespaceRPCInterface.getProcessInfo inside a handler registered by Supervisor.subscribe, the function returns the old state. Seems this is due to new state being assigned after notify(). Shall we move the assignment before notify() or are there other concerns ?

    At https://github.com/Supervisor/supervisor/blob/master/supervisor/process.py#L178,

    events xmlrpc 
    opened by wangchaosjtu 0
  • Supervisorctl update fails with error: <class 'xml.parsers.expat.ExpatError'>, unclosed token: line 27, column 0: file: /usr/lib/python3.8/xmlrpc/client.py line: 449

    Supervisorctl update fails with error: , unclosed token: line 27, column 0: file: /usr/lib/python3.8/xmlrpc/client.py line: 449

    I am using supervisor in combination with cron inside docker. Cron periodically updates the program configuration in config.d and then triggers a supervisorctl update. This crashes always with the error mentioned in the title already:

    error: <class 'xml.parsers.expat.ExpatError'>, unclosed token: line 27, column 0: file: /usr/lib/python3.8/xmlrpc/client.py line: 449
    

    I found #85 and thought it is related but I have no ANSI characters in my program names, only Japanese Kanji but those are represented correctly. The issue seems to be when the parser is closed. The last message is always incomplete.

    b"<?xml version='1.0'?>\n
    <methodResponse>\n
    <params>\n
    <param>\n
    <value><array><data>\n
    <value><struct>\n
    <member>\n
    <name>name</name>\n
    <value><string>&#29572;&#38306;</string></value>\n
    </member>\n<member>\n<name>group</name>\n
    <value><string>F1</string></value>\n
    </member>\n<member>\n<name>status</name>\n
    <value><int>80</int></value>\n
    </member>\n
    <member>\n
    <name>description</name>\n
    <value><string>OK</string></value>\n
    </member>\n</struct></value>\n
    </data></array></value>\n
    </param>\n
    </params>\n
    </methodRespon"
    

    Since the message itself comes from supervisor and is (maybe) not a problem with the RPC client I post it here in the hope that someone knows where that could come from? I appreciate any pointer.

    Note: If I call update twice very fast from cmd instead of a script it works the second time.

    python 3 
    opened by felixdollack 3
  • using supervisorctl with -s does not provide access to the extended API

    using supervisorctl with -s does not provide access to the extended API

    For my plugin Supvisors (https://github.com/julien6387/supvisors), I am using the following configuration:

    [rpcinterface:supvisors]
    supervisor.rpcinterface_factory = supvisors.plugin:make_supvisors_rpcinterface 
    
    [ctlplugin:supvisors]
    supervisor.ctl_factory = supvisors.supvisorsctl:make_supvisors_controller_plugin
    

    Although the supervisor.ctl_factory is apparently not documented, I have used it to extend the supervisorctl with the new XML-RPC API provided by Supvisors. It works fine when supervisorctl is used with the default conf file or using "-c other_file.conf". However using the "-s url", supervisorctl only provides the legacy commands.

    [bash]$ supervisorctl -s http://localhost:61000 version
    4.2.1
    [bash]$ supervisorctl -s http://localhost:61000 sversion
    *** Unknown syntax: sversion
    [bash]$ supervisorctl sversion
    0.8
    
    opened by julien6387 1
  • How to send Ctrl-C to dotMemory command line CLI when it runs in background with supervisord?

    How to send Ctrl-C to dotMemory command line CLI when it runs in background with supervisord?

    I have multiple .NET Core programs running in a Ubuntu background using supervisord (see below). That supervisord.conf is located in the Hello-World folder.

    [program:hello-world-1]
    command = /all-hello-worlds/dotMemory-Cli-Linux/tools/dotMemory.sh start-net-core --service-input=null --trigger-max-snapshots=5 --trigger-delay=2m --trigger-timer=00:01:00 Hello-World-1.dll
    directory = /all-hello-worlds/Hello-World-1
    autostart = true
    autorestart = unexpected
    stdout_logfile=/dev/fd/1
    stdout_logfile_maxbytes=0
    stderr_logfile=/dev/fd/2
    stderr_logfile_maxbytes=0
    

    In each supervisord.conf, I use: dotMemory.sh start-net-core --trigger-delay=1m --trigger-timer=00:00:10 ./HelloWorld.dll

    When the supervisord runs the .NET Core programs in the background, I could see the dotMemory printing message saying about "Press Ctrl+C to end the profiling"

    Those .NET Core programmes are bundled in a Dorker container, which runs /usr/bin/supervisord -c /all-hello-worlds/supervisord.conf

    Here is another supervisord.conf called supervisord.conf which is located in the all-hello-worlds folder

    ; supervisor config file
    
    [unix_http_server]
    file=/var/run/supervisor.sock   ; (the path to the socket file)
    chmod=0700                       ; sockef file mode (default 0700)
    
    [supervisord]
    logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
    pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
    childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)
    nodaemon = true   ; run in the background aka daemonizing
    
    ; the below 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: sections
    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    
    [supervisorctl]
    serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket
    
    ; 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 = /all-hello-worlds/*/supervisord.conf
    

    You can visualise the folder structure in Ubuntu as followed:

    all-hello-worlds (root folder)
    | --- dotMemory-Cli-Linux
    | --- supervisord.conf
    | --- Hello-World-1
       | --- Hello-World-1.dll
       | --- supervisord.conf
    | --- Hello-World-2
       | --- Hello-World-2.dll
       | --- supervisord.conf
    

    Now I struggle sending Ctrl-C command to supervisord Hello-World processes. If I use supervisorctl stop Hello-World-1, the dotMemory does not save the DMW file properly & I need to use dotMemory recover method to get the DMW file (which is troublesome)

    If I use kill -SIGINT [dotMemory process ID], the supervisord restarts the process & does not save the DMW file properly.

    Is there anyway to send Ctrl-C command to dotMemory running in the background with supervisord? I have attached 2 supervisord.conf files here.

    Let me know if you need more information from me. Thanks.

    question 
    opened by blakeex 0
  • feature: add optional parameter depends_on attribute to start dependent processes consecutively

    feature: add optional parameter depends_on attribute to start dependent processes consecutively

    In this pull request I implemented an optional process parameter depends_on. This optional depends_on option is used to only start a process once the required process reached the RUNNING state, or else start all dependee processes first. Features:

    • Dependency cycles will be detected before the start of supervisor.
    • A timeout is thrown (spawnerror) if a process stays in STARTING for too long (default 60 seconds). If a process does not make it to RUNNING before the timeout is reached, all processes left in the dependee queue will be set to FATAL. This time can be set with the optional process parameter spawn_timeout. This comes in handy when using depends_on in combination with runningregex https://github.com/Supervisor/supervisor/pull/1446
    • The depends_on parameter can be used with multiple dependencies which are seperated by a whitespace. If the process is part of a group the group name also has to be added before a colon (:).

    In the following there are two minimal examples:

    ##################

    In the following minimal example, "Hello World!" is printed. [group:examplegroup] programs=world

    [program:hello] command = /bin/sh -c "echo Hello" autostart=false autorestart=false startsecs=0 stdout_logfile = ./log/hello_world.log stderr_logfile = ./log/hello_world_err.log

    [program:world] command = /bin/sh -c "echo World" autostart=false autorestart=false startsecs=0 stdout_logfile = ./log/hello_world.log stderr_logfile = ./log/hello_world_err.log

    [program:start_hello_world] command = /bin/sh -c "echo !" depends_on=hello examplegroup:world autostart=true autorestart=false stdout_logfile = ./log/hello_world.log stderr_logfile = ./log/hello_world_err.log startsecs=0

    ###############

    [program:foo] command = /bin/sh -c "sleep 2 && echo foo (depends on bar) is running at && date && sleep 10" autostart=true autorestart=false startsecs=0 stdout_logfile = ./logs/%(program_name)s_stdout.log stderr_logfile = ./logs/%(program_name)s_stderr.log.log runningregex=foo*is running at depends_on:bar

    [program:bar] command = /bin/sh -c "sleep 80" autostart=false autorestart=false startsecs=70 stdout_logfile = ./logs/%(program_name)s_stdout.log stderr_logfile = ./logs/%(program_name)s_stderr.log spawn_timeout=71

    opened by michaelhammann 0
  • Symlink rotation (Capistrano) are not supported

    Symlink rotation (Capistrano) are not supported

    Hello,

    One of our partners encounter an issue with Capistrano which rotate symlink on deploy.

    Supervisord seems to cache symlink resolution (like .. many other daemons : Apache2 / Nginx).

    We find a working workarround by hard restarting supervisord, which is perfectible.

    You should be able to reproduce this behaviour if you put a symlink as directory within a configuration file :

    [program:akeneo_queue_consumer] command=/usr/bin/php7.2 ./bin/console akeneo:batch:job-queue-consumer-daemon --env=prod numprocs=1 autostart=true autorestart=true directory= /var/www/current <= this has to be a symlink (for example on Capistrano to /var/www/releases/202107081214/) user=www-data

    In case you have another solution to "flush the symlink resolution cache" (which seems to be a system design issue from linux command stat/lstat..), we are interested.

    Thanks you,

    Kind regards,

    Vincent

    opened by touchweb-vincent 1
  • feature: add support for runningregex to set RUNNING state accordingly

    feature: add support for runningregex to set RUNNING state accordingly

    The runningregex option can be used to only set the RUNNING state of a process, if the child process is considered to be running. This is done by looking into the stdout and check whether an expected output has been recognized. If so, the process will set to running state. This requires the child process to create the corresponding output, otherwise the RUNNING state is never reached.

    Closes #1445

    This option can be used by adding runningregex to the config of a program.

    In the following minimal example, the running state will be set when "Hello World!" is printed. [program:hello_world] command = /bin/sh -c "sleep 10 && echo Hello World! && sleep 10" runningregex=Hello stdout_logfile=./log/hello_world.log

    opened by michaelhammann 0
Run a subprocess in a pseudo terminal

Launch a subprocess in a pseudo terminal (pty), and interact with both the process and its pty. Sometimes, piping stdin and stdout is not enough. Ther

null 149 Oct 16, 2021
Python process launching

sh is a full-fledged subprocess replacement for Python 2.6 - 3.8, PyPy and PyPy3 that allows you to call any program as if it were a function: from sh

Andrew Moffat 5.9k Oct 18, 2021