Supervisor: Differences between reread, reload, restart, update?

Created on 13 Feb 2016  ·  30Comments  ·  Source: Supervisor/supervisor

Perhaps I missed it but is there a good explanation anywhere as to the differences between these four commands? I didn't see them discussed in the supervisord online documentation. I've noticed on ServerFault and Stackoverflow that other users don't understand their differences either.

For example, if I change the configuration in one program section, I know I must do "supervisorctl reread" to have those changes made available. But how do you restart just that one program? supervisorctl restart doesn't work. Instead if appears that you must either run "supervisorctl update" or restart the supervisor daemon itself. However, this seems to have the unintended effect of restarting all programs, not just the one that changed.

Thanks.

docs

Most helpful comment

Would the following definitions work for the documentation ?

reread - Reread supervisor configuration. Do not update or restart the running services.
update - Restart service(s) whose configuration has changed. Usually run after 'reread'.
reload - Reread supervisor configuration, reload supervisord and supervisorctl, restart services that were started.
restart - Restart service(s)

All 30 comments

Perhaps I missed it but is there a good explanation anywhere as to the differences between these four commands?

No, this should be added to the documentation. I've added the docs label and will leave this issue open so we do that.

Still find the current docs confusing.

Thank you, friend.

On Tue, Dec 13, 2016 at 7:35 AM, Paweł Adamczak notifications@github.com
wrote:

What helped me - http://www.onurguzel.com/supervisord-restarting-and-
reloading/


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Supervisor/supervisor/issues/720#issuecomment-266770482,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEgNpM6R9BMwE03q_DejU96qUOef8zCtks5rHrtMgaJpZM4HZsaj
.

@flaugher I still think it's worth keeping this issue open, as the docs still don't have the relevant information.

I was actually planning to look into making a PR on the weekend.

If you want to re-open it, go ahead. I didn’t see anything new and have moved beyond the issue and didn’t want to keep getting notifications. I couldn’t figure out how to mute it so I just closed it.

On Dec 13, 2016, at 4:03 PM, Paweł Adamczak notifications@github.com wrote:

@flaugher I still think it's worth keeping this issue open, as the docs still don't have the information.

I was actually planning to look into making a PR on the weekend.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

As a non project member or issue creator I can't open it, but I do get your point completely.

BTW - As far as I know you can unsubscribe from the notifications on the right side menu in issue view

Lastly - sorry for the spam : -)

Hi everyone.

IMHO, I agree with the re-opening of this issue.

Although the doc bellow can shed a light on the issue, it seems a little bit vague regarding the definitions.

Regarding the "update" action, I believe that there are more things to be described or better described, for example.

Here is the scenario: when you create a configuration for a process to be managed by "supervisord", you run "supervisorctl update" and then comes the message "your_configured_process: added process group". Is there any kind of group controlled by "supervisord", which must contain a record that specifies that your process is now managed by "supervidord"?

In my last searches on Google, I also found this man page at Ubuntu website, and it doesn't seem to have explanations for supervisorctl actions..

Can anyone (member of the project) reopen this issue? Seems like that I'm not the only one who believes that this must be done.

Thanks
@ivanleoncz

So where the answer ?

+1 for re-opening. reread|reload|restart|update are still undocumented.

Hi, Sorry to be this guy, but, could we re-open that issue? Thanks.

@pawelad How did that help you? The second sentence is flat out wrong.

However it does not have a reload option.

Supervisor most certainly has a reload option...

Yet someone else here that would really appreciate some _usable_ documentation...

Wow. I can not believe this issue exists. Thanks @ivanlmj for the informative links.

You're welcome, @cornfeedhobo . Thank you for regarding this issue :).

Someone please explain the reload action: what I'm expecting from this one is basically a reread + update. Is that what the current behaviour is ?

It most certainly is not, but you would think so! Man some updated docs would be great right about now ....

@mnaberez can we have clear definition of every one of those terms ?
If you can detail them here, I'd be happy to make a pull request to the docs.

Would the following definitions work for the documentation ?

reread - Reread supervisor configuration. Do not update or restart the running services.
update - Restart service(s) whose configuration has changed. Usually run after 'reread'.
reload - Reread supervisor configuration, reload supervisord and supervisorctl, restart services that were started.
restart - Restart service(s)

Pretty nice!
Have you certified that these are the real aspects of each action, @ocervell ? If you are sure about it, it would be nice to send a PR for the documentation! Just saying :)! Thanks!

I tried supervisorctl reread and update, and found that 'update' just does the reread's job: reload the application config. so what's the need for the 'reread' action? I found confused

$ supervisorctl help update
update          Reload config and add/remove as necessary, and will restart affected programs
update all      Reload config and add/remove as necessary, and will restart affected programs
update <gname> [...]    Update specific groups

So reread is not needed?

I find it still a little confusing. Currently I run update and restart all on an update of our software. This could be:

  • A supervisor configuration file is changed
  • A script is changed and requires restarting.

But when a supervisor configuration is updated, the script is restarted twice (because update and restart all). I also tried reread and restart all, but in this case new config files didn't start automatically.

Is there a command or combination of commands that will reload all configuration files and restart all scripts without restarting them twice and loading and starting new configuration files found?

Nobody on @Wouter0100 's question?

@Wouter0100 Considering you "restart all" what you want might be best accomplished by a "realod", although in a slightly different way:
Reload will stop the supervisor daemon, reload the configuration and then restart the daemon. Assuming your processes have autostart=true (the default) everything will be restarted exactly once.

If you need something less sweeping, I fear you are out of luck: reread will not start new processes found (as you have noticed) and update will restart only if the configuration changes, and it will not restart processes (e.g.) whose (supervisord) config stayed the same, but whose executable changed to a new version.

I posted another solution at #1264.

@AlekSi not really a solution, as this requires specifying every file individually.

Well, that depends on your use case. In my case that Ansible task works:

    - name: Restart services
      command: supervisorctl {{ item.1 }} {{ item.0 }}
      with_nested:
        - ['x', 'y', 'z']
        - ['stop', 'remove', 'add']

Questions posted on duplicate issue #1264:

It is somewhat a continuation of #720 that is closed but contains comments from a lot of confused people.

My problem

I need to restart service X exactly once after its package is updated. It contains service binary and a part of supervisord configuration that is include-ed from the main file.

My attempts

1. `supervisorctl update` does not restart service if configuration file did not change, old binary is still running.

2. `supervisorctl restart` restarts service with the old configuration, the new configuration is not used.

3. `supervisorctl reread && supervisorctl restart` does the same as the one above – and that is very surprising!

4. `supervisorctl update && supervisorctl restart` restarts service twice if configuration file changed.

My solution

supervisorctl reread

supervisorctl stop X
supervisorctl remove X
supervisorctl add X  # that also starts X as I have `autostart = true` in configuration

That works. But is it really the best way?
And why attempt 3 did not work?

That works. But is it really the best way?

Yes

And why attempt 3 did not work?

The command reread causes supervisord to reread the configuration file and become aware of the changes, but it does not apply any of those changes to the active configuration. The remove and add commands are used to apply those changes to the active configuration.

Was this page helpful?
0 / 5 - 0 ratings