Skip to content

Instantly share code, notes, and snippets.

@tzkmx
Created October 10, 2017 05:30
Show Gist options
  • Save tzkmx/7ca25363d9c73ebeca03d5378be04e77 to your computer and use it in GitHub Desktop.
Save tzkmx/7ca25363d9c73ebeca03d5378be04e77 to your computer and use it in GitHub Desktop.
SystemD Units to watch and fix PHP FPM pool definition files
#! /bin/bash
sed -i -e '/catch_workers_output/d; /pm.max_children = 5/s/.*/pm.max_children = 10\npm.max_requests = 50/;' $1
[Unit]
Description= Watches changes to PHP FPM Pool definition: %p/%i.
Documentation= man:systemd.path
[Path]
PathChanged=/opt/plesk/%P/php-fpm.d/%i.conf
[Install]
WantedBy=multi-user.target
[Unit]
Description= Fixes undesired changes to [%p:%i] pool
Documentation= man:systemd.service
[Service]
Type=oneshot
ExecStart=/root/fix_php_fpm_pool.sh /opt/plesk/%P/php-fpm.d/%i.conf %i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment