centos 7.1 - supervisord terminates if run with systemctl

7,005

As pointed out by Mike Naberezny, here, all it needed was to add Type=forking to the Service section of the supervisord.service:

[Service]
Type=forking
ExecStart=/usr/bin/supervisord
ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown
ExecReload=/usr/bin/supervisorctl $OPTIONS reload
Share:
7,005

Related videos on Youtube

Sam R.
Author by

Sam R.

That which can be asserted without evidence, can be dismissed without evidence. - Christopher Hitchens (1949-2011) The avatar is called The Town of Thoughts by the magnificent Marija Tiurina.

Updated on September 18, 2022

Comments

  • Sam R.
    Sam R. over 1 year

    So I have a weird problem and I've been banging my head for the entire day. I have a centos 7.1 with supervisord 3.2.0 installed. If I run the supervisor with systemctl, it runs and then it shuts down itself after few seconds.

    sudo systemctl start supervisord
    sudo systemctl enable supervisord
    

    But if I run it manually, like:

    sudo /usr/bin/supervisord
    

    it'll work just fine. Here are the files:

    # /usr/lib/systemd/system/supervisord.service
    [Unit]
    Description=Supervisor daemon
    
    [Service]
    ExecStart=/usr/bin/supervisord
    ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown
    ExecReload=/usr/bin/supervisorctl $OPTIONS reload
    KillMode=process
    Restart=on-failure
    RestartSec=42s
    
    [Install]
    WantedBy=multi-user.target
    

    AND

    # /etc/supervisord.conf
    [unix_http_server]
    file=/tmp/supervisor.sock   ; (the path to the socket file)
    
    [supervisord]
    logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
    logfile_maxbytes=50MB        ; (max main logfile bytes b4 rotation;default 50MB)
    logfile_backups=10           ; (num of main logfile rotation backups;default 10)
    loglevel=info                ; (log level;default info; others: debug,warn,trace)
    pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
    nodaemon=false               ; (start in foreground if true;default false)
    minfds=1024                  ; (min. avail startup file descriptors;default 1024)
    minprocs=200                 ; (min. avail process descriptors;default 200)
    
    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    
    [supervisorctl]
    serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket
    

    journal logs:

    Dec 07 22:32:07 supervisord[2421]: /usr/lib/python2.7/site-packages/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searchi
    Dec 07 22:32:07 supervisord[2421]: 'Supervisord is running as root and it is searching '
    Dec 07 22:32:07 supervisorctl[2425]: Shut down
    Dec 07 22:58:29 supervisorctl[4181]: Shut down
    Dec 07 22:59:35 supervisorctl[4316]: Shut down
    Dec 07 22:59:43 supervisorctl[4337]: Shut down
    

    systemctl status:

    supervisord.service - Supervisor daemon
    Loaded: loaded (/usr/lib/systemd/system/supervisord.service; enabled)
    Active: inactive (dead) since Mon 2015-12-07 22:59:43 UTC; 7min ago
    Process: 4337 ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown (code=exited, status=0/SUCCESS)
    Process: 4333 ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf (code=exited, status=0/SUCCESS)
    Main PID: 4333 (code=exited, status=0/SUCCESS)
    Dec 07 22:32:07 supervisord[2421]: /usr/lib/python2.7/site-packages/supervisor/options.py:296: UserWarning:
    Dec 07 22:32:07 supervisord[2421]: 'Supervisord is running as root and it is searching '
    Dec 07 22:32:07 supervisorctl[2425]: Shut down
    
    • minorcaseDev
      minorcaseDev over 8 years
      Add output of sudo systemctl status supervisord after it shuts down to your question.
    • VenkatC
      VenkatC over 8 years
      Also add output of journalctl _SYSTEMD_UNIT=supervisord.service
    • Sam R.
      Sam R. over 8 years
      @Cyrus, @VenkatC. I added those but nothing really special. Also, sudo supervisorctl gives unix:///tmp/supervisor.sock no such file. But again the manual execution creates the supervisor.sock just fine.