Re: automatic service restart
Panu Matilainen <[email protected]> Wed, 11 Aug 2004 10:15:06 +0300 (EEST)
| Newsgroups | gmane.linux.conectiva.apt-rpm |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 11 Aug 2004, Marcel Ritter wrote:
> Hi there!
>
> I'm running into a little trouble with newer apt-rpm releases:
>
> In old versions the rpm binary was called from within apt-get
> and could be replaced by a wrapper skript. I did this to cleanly
> shutdown updated services before the new package got installed
> and to restart them afterwards. This worked fine - newer releases
> use librpm functions to get rid of the extra "rpm" call.
>
> Unfortunately this breaks my wrapper skript approach. Can a similar
> behaviour be programmed in lua? Has perhaps anyone done so?
> Any hints how to start?
Several ways to do it... but really the (cond-)restarting of services
should be done from rpm %post etc scripts, not externally.
But if you have to use an external script to do that, the following are
possible (in no particular order)
1) Use RPM::PM="external" to revert back to old behavior of calling
external rpm (not recommended for other reasons)
2) Use the "old" script interface through RPM::Pre-Invoke / Post-Invoke to
run scripts before and after the operation completes (or perhaps
Pre-Install-Pkgs and Post-Install-Pkgs)
3) Use a Lua script for it in Scripts::PM::Pre:: and Scripts::PM::Post::
(you can basically just call os.execute("/sbin/service ...") from lua)
- Panu -