On 1/10/20 6:34 PM, Jonathan Billings wrote:
On Fri, Jan 10, 2020 at 06:18:07PM +0300, Benson Muite wrote:
Am rebuilding httpd from scratch to enable http2 and minimize extra modules on Cent Os 8. Am having trouble understanding the spec file [0] and systemd initialization [1][2][3] (these are very similar to those extracted from [4]). Why are 3 scripts needed to start the service and why is a pid setting not needed as used in the httpd.service file at [5]?
The httpd-init.service handles some ssl cert generation on the first time a system runs, so httpd doesn't just die because there were missing SSL certs. They're self-signed. The httpd.socket unit lets you have systemd listen on port 80 and only start httpd if someone connects. THat's not a standard use, though.
The httpd.service in the Fedora/CentOS systemd service unit uses Type=notify instead of Type=forking. While it's possible for systemd to keep track of all the subprocesses of a forking daemon, its difficult to determine if the service is "started". It uses the Pid file for that.
With Type=notify, the daemon will send a notification back to systemd via sd_notify() when it is up, which makes it easier for systemd to know when a service has started, and start any dependencies or established that a target has been reached. You need a service that supports Type=notify, which httpd does.
Thanks. Seems like need to use development version [0] or use patch [1]
[0] https://svn.apache.org/viewvc/httpd/httpd/trunk/modules/arch/unix/mod_system...
[1] https://src.fedoraproject.org/rpms/httpd/blob/master/f/httpd-2.4.33-systemd....