Error when adding supervisord to run via systemd

Newskooler asked:

I am trying to run supervisor from systemd and I am following this tutorial here.

Upon creating this file /etc/systemd/system/supervisord.service with the following contents:

[Unit]
Description=Supervisor daemon
Documentation=http://supervisord.org
After=network.target

[Service]
ExecStart=/usr/local/bin/supervisord -n -c /etc/supervisor/supervisord.conf
ExecStop=/usr/local/bin/supervisorctl $OPTIONS shutdown
ExecReload=/usr/local/bin/supervisorctl $OPTIONS reload
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target
Alias=supervisord.service

When I run it I get the following error:

Mar 17 01:18:22 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: Started Supervisor daemon.
Mar 17 01:18:22 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[8772]: supervisord.service: Failed to execute command: No such file or directory
Mar 17 01:18:22 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[8772]: supervisord.service: Failed at step EXEC spawning /usr/local/bin/supervisord: No such file or directory
Mar 17 01:18:22 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: supervisord.service: Main process exited, code=exited, status=203/EXEC
Mar 17 01:18:22 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: supervisord.service: Failed with result 'exit-code'.
Mar 17 01:19:04 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: supervisord.service: Service hold-off time over, scheduling restart.
Mar 17 01:19:04 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: supervisord.service: Scheduled restart job, restart counter is at 1.
Mar 17 01:19:04 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: Stopped Supervisor daemon.

Clearly it says that there is no such directory, but is creating one actually the correct way to solve the problem?

The reason why I am unsure is because when looking at other (I guess) similar issues (example: here), they seem to fix it differently. Also in the tutorial, it does not mention this path (the one that does not exist) anywhere else besides in the contents of supervisord.service, so I am quite confused what is happening here.

Can anyone please explain to me or point me to something specific to read in order to solve my problem in the correct way?

Thanks!

UPDATE

locate supervisord yields:

/etc/supervisor/supervisord.conf
/etc/systemd/system/supervisord.service
/usr/bin/echo_supervisord_conf
/usr/bin/supervisord
/usr/lib/python2.7/dist-packages/supervisor/supervisord.py
/usr/lib/python2.7/dist-packages/supervisor/supervisord.pyc
/usr/lib/python2.7/dist-packages/supervisor/tests/test_supervisord.py
/usr/lib/python2.7/dist-packages/supervisor/tests/test_supervisord.pyc
/usr/share/man/man1/echo_supervisord_conf.1.gz
/usr/share/man/man1/supervisord.1.gz
/var/log/supervisor/supervisord.log

locate supervisorctl yields:

/usr/bin/supervisorctl
/usr/lib/python2.7/dist-packages/supervisor/supervisorctl.py
/usr/lib/python2.7/dist-packages/supervisor/supervisorctl.pyc
/usr/lib/python2.7/dist-packages/supervisor/tests/test_supervisorctl.py
/usr/lib/python2.7/dist-packages/supervisor/tests/test_supervisorctl.pyc
/usr/share/man/man1/supervisorctl.1.gz

My answer:


You didn’t actually follow that tutorial and install the supervisor package via easy_install; it’s installed from Ubuntu packages. The package already contains a systemd unit supervisor.service which you can just start. You don’t need to create your own unit.

That tutorial is also pretty bad for not explaining why they have made the strange decisions they have made. I would just throw away that tutorial and use the existing supervisor unit that you already have.

Of course, I’d also just throw away supervisord because it’s redundant; virtually everything it does is covered (and better) by systemd. I would also throw away whatever tutorial led you to try installing supervisord.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.