1

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
Newskooler
  • 157
  • 1
  • 1
  • 10
  • 2
    First, run the command `updatedb`. Afterwards, add the output of `locate supervisord` and `locate supervisorctl` to your question. – Nasir Riley Mar 17 '19 at 01:44
  • @NasirRiley I just added this. – Newskooler Mar 17 '19 at 01:55
  • Here is documentation for `supervisord`: http://supervisord.org/. Here it is for `systemd`: https://www.freedesktop.org/wiki/Software/systemd/. You can find a lot more by Googling. The answer that I gave explains why it wasn't starting but you really don't need it for the reasons already given by Michael. – Nasir Riley Mar 17 '19 at 15:32

2 Answers2

2

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.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • Thank you very much for the input. I am lost myself between deciding if I should use supervisord or systemd. Could you please show me where I can read more about the two. I am considering throwing out supervisord as it seems to add more complexity for no clear reason, but I just want to find out more about it. Thanks! – Newskooler Mar 17 '19 at 15:28
  • 1
    Their respective web sites might be a good start? But your sense is correct. Supervisor was written to control processes at a time when the init system was pretty primitive; it hadn't changed significantly since the 1970s! Systemd changed all that and pretty much made supervisord obsolete. – Michael Hampton Mar 17 '19 at 15:30
1

Your service file is specifying the wrong locations for the binaries.

In the file, change

/usr/local/bin/supervisord

To

/usr/bin/supervisord

And

/usr/local/bin/supervisorctl 

To

/usr/bin/supervisorctl 

Next, run the command systemctl daemon-reload and then systemctl start supervisord.

Nasir Riley
  • 2,035
  • 8
  • 9
  • Okay, so the `ExecStart` is executing supervisor from the place where it is installed. Is it a problem to be installed in `/usr/bin` vs `/usr/local/bin`? – Newskooler Mar 17 '19 at 02:04
  • @Newskooler No. It doesn't matter as long as the path in the service file is the location where it is actually located and the location allows executables. – Nasir Riley Mar 17 '19 at 02:12
  • After adding the path, I still get errors, hence why I did not accept this answer. – Newskooler Mar 17 '19 at 15:35
  • @Newskooler Then you should have stated that and added the errors to your question so that they could have been addressed. It looks like you've decided not to use it anyway so it doesn't matter. – Nasir Riley Mar 17 '19 at 15:36
  • You are correct and make a fair point. – Newskooler Mar 17 '19 at 15:40