[PLUG] Questions about systemd...

michael at robinson-west.com michael at robinson-west.com
Thu Nov 1 14:05:12 UTC 2018


I am on CentOS 7 running custom compiled Apache and PHP-FPM through systemd.

I have the following systemd scripts in /opt/etc/systemd/system/.
----------------------------------------------------------------------------------------------------------------------------------
php-fpm.service:
[root at goose system]# cat php-fpm.service
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
type=forking
PIDFile=/opt/logs/php-fpm.pid
EnvironmentFile=/opt/etc/sysconfig/php-fpm
ExecStart=/opt/sbin/php-fpm --nodaemonize --fpm-config /opt/etc/apache/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target
----------------------------------------------------------------------------------------------------------------------------------
httpd.service:
[root at goose system]# cat httpd.service
[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=forking
PIDFile=/opt/logs/httpd.pid
EnvironmentFile=/opt/etc/sysconfig/httpd
ExecStart=/opt/bin/apachectl start --nodaemon
ExecReload=/opt/bin/apachectl reload
ExecStop=/opt/bin/apachectl stop

[Install]
WantedBy=multi-user.target
----------------------------------------------------------------------------------------------------------------------------------------
htcacheclean.service:
[root at goose system]# cat htcacheclean.service
[Unit]
Description=Disk Cache Cleaning Daemon for Apache HTTP Server
After=httpd.service
Documentation=man:htcacheclean(8)

[Service]
Type=forking
User=apache
PIDFile=/run/httpd/htcacheclean/pid
EnvironmentFile=/opt/etc/sysconfig/htcacheclean
ExecStart=/opt/bin/htcacheclean -P /run/httpd/htcacheclean/pid -d $INTERVAL -p $CACHE_ROOT -l $LIMIT $OPTIONS
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Note that the stock httpd.service file doesn't set the type to forking and it has an option of PrivateTMP or something similar.

I don't recall seeing type forking in the stock php-fpm.service file either.

What is the htcacheclean service? How do I make sure that it caches to where I expect it to? I suspect the CACHE_ROOT should be set to /opt/var/cache/apache or something similar. I compiled Apache and PHP-FPM to /opt to make sure I don't collide accidentally with the stock php and apache which are yum removed at the moment. Any tips on how to turn selinux back on and configure it to recognize the /opt/htdocs/... document roots would be much appreciated.



More information about the PLUG mailing list