0

I am facing an issue that everytime I hard restart my server (maybe went bananas due to out of memory, ddosed etc) supervisor fails to run. And the reason for that is identified and simply /var/run/supervisor directory is deleted.

I learned that /var/run folders are deleted on hard reboot (via ec2 panel for instance force stop then start), so my humble question is:

How can I execute this mkdir /var/run/supervisor after every hard reboot ? Where is the perfect place to add such logic. I guess it is not /etc/profile for sure

(the rest works fine, supervisor is configured as service + uses unix sock at var/run/supervisor/supervisor.sock)

My ubuntu version:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal

1 Answers1

1

In Ubuntu 20 I would expect that supervisor is started as a systemd service unit.

In the service unit for supervisor you need to specify that the directory is created: (the unit name might be different)

https://serverfault.com/a/779648 & https://serverfault.com/a/840999

sudo systemctl edit --full supervisor

and add a directive:

RuntimeDirectory=supervisor 
NoBody
  • 26
  • 1
  • Thank you. I edited `systemctl edit --full supervisord.service` because nothing was found with supervisor to ```[Unit] Description=Supervisor daemon Documentation=http://supervisord.org After=network.target [Service] ExecStart=/usr/local/bin/supervisord -n -c /etc/supervisord.conf ExecStop=/usr/local/bin/supervisorctl $OPTIONS shutdown ExecReload=/usr/local/bin/supervisorctl $OPTIONS reload KillMode=process Restart=on-failure RestartSec=42s RuntimeDirectory=supervisor [Install] WantedBy=multi-user.target Alias=supervisord.service ``` – Kristi Jorgji Mar 31 '22 at 09:08
  • I chose your answer as solution , thank you. Next time hard reboot happens can verify if worked correctly – Kristi Jorgji Mar 31 '22 at 09:50