Commit a6dc0c9e authored by mh's avatar mh
Browse files

add a timer to kill childrens not serving a request

parent 8adf8a32
[Unit]
Description=Kill fpm pools not serving requests
[Service]
ExecStart=/usr/local/sbin/fpm-kill-pool.sh
[Install]
WantedBy=default.target
#!/bin/bash
shopt -s nullglob
for fpm in /run/fpm-*/pid; do
CHILDREN=$(ps -o pid --no-headers --ppid `cat ${fpm}` | wc -l)
if [ "${CHILDREN}" == "0" ]; then
kill `cat ${fpm}`
fi
done
......@@ -43,6 +43,7 @@ define php::fpm(
} ~> Exec['systemctl-daemon-reload']
if $ensure == 'present' {
include ::php::fpm::base
File[ "${etcdir}/php-fpm.d/${name}.conf"]{
group => $run_group,
}
......
# fpm base stuff
class php::fpm::base {
file{
'/usr/local/sbin/fpm-kill-pool.sh':
source => 'puppet:///modules/php/fpm/kill-pool.sh',
owner => root,
group => 0,
mode => '0755',
} -> systemd::unit_file{
'fpm-kill-pool.service':
source => 'puppet:///modules/php/fpm/kill-pool.service',
} -> systemd::unit_file{
'fpm-kill-pool.timer':
content => content('php/fpm/fpm-kill-pool.timer.erb'),
} ~> service{
'fpm-kill-pool.timer':
ensure => running,
enable => true,
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment