-
-
Save blacksaildivision/199f9806dc68b2e7cf78713ae4631dfe to your computer and use it in GitHub Desktop.
[Unit] | |
Description=The Apache HTTP Server | |
After=network.target | |
[Service] | |
Type=forking | |
ExecStart=/usr/local/apache2/bin/apachectl -k start | |
ExecReload=/usr/local/apache2/bin/apachectl -k graceful | |
ExecStop=/usr/local/apache2/bin/apachectl -k graceful-stop | |
PIDFile=/usr/local/apache2/logs/httpd.pid | |
PrivateTmp=true | |
[Install] | |
WantedBy=multi-user.target |
thank you ,works well in my case
If you look at the apachectl
script it calls systemctl start httpd.service
so you have infinite recursion here. Your service calls apachectl
which starts the httpd
service.
If you look at the
apachectl
script it callssystemctl start httpd.service
so you have infinite recursion here. Your service callsapachectl
which starts thehttpd
service.
Thanks for the comment! This gist was made 4 years ago, it might have changed how apachectl
works since then:) I just had a quick look onto the apachectl source code in the repo https://github.com/apache/httpd/blob/trunk/support/apachectl.in and it looks like that the script does not call systemctl directly but uses httpd
binary instead. Didn't compile it though so the output might be different.
Since 2.4.42, httpd has native support for systemd. Compile mod_systemd with the flag:
$ ./configure --enable-systemd
The docs provide the following unit file:
# Example of systemd service unit (more settings are probably needed for production systems)
[Unit]
Description=The Apache HTTP Server
After=network.target
[Service]
Type=notify
ExecStart=/usr/local/apache2/bin/httpd -D FOREGROUND -k start
ExecReload=/usr/local/apache2/bin/httpd -k graceful
KillMode=mixed
[Install]
WantedBy=multi-user.target
See the note there on ExecStop
.
Thank you Dude, it works here.