开发者

What's a good method to trigger apache restart after .deb installation?

I have several custom .debs that I've built. They all depend on apache and after up开发者_运维问答grade of any package apache needs to be restarted.

Restarting apache naively from the postinst I get a restart for each package I upgrade, which is really slow. Does anyone know if there's a good way to avoid that? Dpkg triggers seems to be the right approach but I can't seem to find much in the way of documentation. Does apache define its own trigger to activate. If so, how do I call it?


Yes, dpkg triggers would be the right approach here. And no, I don't believe that there is any preexisting trigger-fu to solve this problem for you.

At its most simple, your setup might consist of something like the following:

  • Some common package, on which all of your apache-using debs will Depend. Let's call it "apache-coordination".
  • apache-coordination's DEBIAN/triggers file should contain a line like interest apache-coordination-reload.
  • apache-coordination's postinst should handle the case where it gets called with the argument "triggered" and where "apache-coordination-reload" is somewhere in the second argument, by performing the actual apache reload or restart (ideally through invoke-rc.d or something similar, so that runlevels are respected).
  • Your other packages should activate the apache-coordination-reload trigger when appropriate. This could be done by shipping DEBIAN/triggers files for each of them containing activate apache-coordination-reload.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜