(re)starting of a daemon after package update

Michal Hlavinka mhlavink at redhat.com
Tue Jun 19 16:06:35 UTC 2012


I'm trying to find out what is the best place to restart service after 
update. Dovecot have runs several binaries, has some plugins,... in 
short, it does not like when it's running during update. I was asked by 
upstream to modify rpm package to stop it before update and start it 
afterwards (it does try-restart in %postun now). Looks simple. I check 
whether it's running in %pre script, create a flag and stop it. After 
update, I check the flag and start it again. The problem is where to put 
this second script?

Correct approach would be to save state before installation of new 
version starts and start dovecot (if flag is set) after old version is 
removed - that would mean %postun script. This does not seem to work on 
reinstall (the same version is installed) - %postun script is not executed.

So I'm considering 3 options right now
1)ignore reinstall scenario

2)start dovecot in %post script - when there are all new files, but old 
ones were not removed yet. This can cause trouble for example if dovecot 
changes config files in conf.d/*.conf and some file gets renamed/removed.

3)start dovecot in %posttrans script - all files are removed, but it's 
after all packages are updated and old removed. It can take half to five 
minutes (or even more) - between dovecot is stopped and started again.

Is there any other (and better) solution?


More information about the devel mailing list