11

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?

1 Answer 1

16

The supervisorctl command can be run as a non-root user. All you need to do is give it permission to connect to the supervisord 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 your supervisord setup.

If you use the [unix_http_server] setup, you'd add chmod and/or chown directives to control who can access the UNIX domain socket, for example:

[unix_http_server]
chown = youruser

so that youruser can write to that socket, which means supervisorctl can send supervisord commands. You can also add a group:

[unix_http_server]
chown = youruser:yourgroup

Finally, you'll have to restart supervisord itself with service supervisor restart

2
  • Thanks, also I tried to define a process group but supervisor isn't seeing it, even after a restart of supervisord itself. Is there some config I'm missing other than a [group:x] with programs & priority defined? Dec 1, 2012 at 20:20
  • 1
    @user1561108: You mean you added a [group:groupname] section and after a restart you don't see that added? [group:] sections don't specify permissions to access it, only an easy way to address a whole group of programs (to restart them together, for example), so I am a little confused if this still applies to your original question. Dec 1, 2012 at 21:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .