stop service ; remove some files ; start service in RPM %postun ?

Bill Nottingham notting at redhat.com
Mon Jan 28 17:29:28 UTC 2013


Jan-Frode Myklebust (janfrode at tanso.net) said: 
> I have an rpm package where I need to stop the running service, remove
> some files and start the service again depending on which package
> version was already installed. I assume I need to do this in %postun,
> where we normally do condrestart, but I don't know how to check the
> version of the previously installed package. Could someone help me
> here / does anybody have examples doing something similar ?
> 
> For sysv-init i guess it should be trivial to check "service $name
> status" to see if it was running, and then stop/start it. But what's
> the equivalent for systemd ? Currently I use
> %systemd_postun_with_restart, but that needs to be split up so that I
> can delete the files while the service is down..

I'm curious - why would you need to do this? Seems somewhat fragile to 
be doing automatically on upgrade.

Bill


More information about the devel mailing list