My deb package with the Lighttpd plugin contains a dynamically loadable file usr/lib/lighttpd/mod_pdujson.so and the configuration file etc/lighttpd/conf-enabled/10-pdujson.conf . The project itself is on bitbucket .

In principle, everything works, except that after installing or updating the package, you have to manually give the command lighttpd to reload the configuration and plugins:

 sudo /etc/init.d/lighttpd reload 

How to make it happen automatically after installing or updating the package?

1 answer 1

based on information and recommendations:

and the contents of the actual scripts (in /var/lib/dpkg/info ), you need to add (at a minimum) a debian/имя-собираСмого-ΠΏΠ°ΠΊΠ΅Ρ‚Π°.postinst script, which should be located in the debian/имя-собираСмого-ΠΏΠ°ΠΊΠ΅Ρ‚Π°.postinst type debian/имя-собираСмого-ΠΏΠ°ΠΊΠ΅Ρ‚Π°.postinst file of the debian/имя-собираСмого-ΠΏΠ°ΠΊΠ΅Ρ‚Π°.postinst and contain something like the following:

 #!/bin/sh -e case "$1" in configure) invoke-rc.d lighttpd reload >/dev/null || true ;; *) ;; esac exit 0 
  • Yes, as I understand it, invoke-rc.d is the only thing that is needed, service is still invoked by it, and the direct call from /etc/init.d/ debhelper itself does not do when the ΠΏΠ°ΠΊΠ΅Ρ‚.init.d processes. However, after invoke-rc.d lighttpd reload , other commands do not work with this service, some kind of bug will probably have to be replaced by force-reload - sercxjo
  • @sercxjo force-reload it like? Can immediately restart? - Nick Volynkin ♦
  • @sercxjo, but where did the reload come from? Considering that it is being replaced, as far as I understood, not only the configuration, it is probably best to use a banal restart. - aleksandr barakin
  • @NickVolynkin, many different commands can be implemented in start-stop scripts. it's easy, add more points in the case statement. - aleksandr barakin
  • Strange, but reload and force-reload in /etc/init.d/lighttpd in the same case stand, but work differently. Essentially, everyone does restart, but reload "forgets" the -D key judging by the ps -ax - sercxjo