I have set up supervisor to monitor some processes. Because I deploy via remote script, I need a way to send supervisor start/stop commands without sudo. I'm not sure how to do this though.
Is there a way in supervisor to run specified commands as a non root user?
Best Answer
The
supervisorctl
command can be run as a non-root user. All you need to do is give it permission to connect to thesupervisord
process.You'll need to configure access in the appropriate server section, so in the
[unix_http_server]
section, or in the[inet_http_server]
section, whichever you are using for yoursupervisord
setup.If you use the
[unix_http_server]
setup, you'd addchmod
and/orchown
directives to control who can access the UNIX domain socket, for example:so that
youruser
can write to that socket, which meanssupervisorctl
can sendsupervisord
commands. You can also add a group:Finally, you'll have to restart
supervisord
itself withservice supervisor restart