Skip to content

Instantly share code, notes, and snippets.

@atton
Created July 5, 2017 23:49
Show Gist options
  • Save atton/08a8a722f0403be0c386fd4ff711181d to your computer and use it in GitHub Desktop.
Save atton/08a8a722f0403be0c386fd4ff711181d to your computer and use it in GitHub Desktop.
cat > /usr/lib/systemd/system/httpd.service << EOF
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)
[Service]
Type=notify
#EnvironmentFile=/usr/local/apache2/conf/httpd.conf
ExecStart=/usr/local/apache2/bin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/local/bin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOF
wget https://raw.githubusercontent.com/apache/httpd/trunk/modules/arch/unix/mod_systemd.c
/usr/local/apache2/bin/apxs -c mod_systemd.c -I /usr/include/systemd/sd-daemon.h
libtool \
--silent \
--mode=compile gcc -std=gnu99 -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong \
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_LARGEFILE64_SOURCE -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/include/apr-1 -c -o mod_systemd.lo mod_systemd.c && touch mod_systemd.slo
libtool \
--silent \
--mode=link gcc -std=gnu99 -Wl,-z,relro,-z,now,-L/usr/lib64 -o mod_systemd.la -rpath /usr/local/apache2/modules -module -avoid-version mod_systemd.lo
libtool \
--silent \
--mode=link gcc -std=gnu99 -Wl,-z,relro,-z,now,-L/usr/lib64 -o mod_systemd.la -rpath /usr/local/apache2/modules -module -avoid-version mod_systemd.lo -lsystemd-daemon
/usr/local/apache2/bin/apxs -i -a -n systemd mod_systemd.la
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment