# /bin/bash
## Afrihost - reset php_fpm_values to afrihost default on the whole 
# server for each domain that had php-fpm
#
# 
## cpanel check
if ! [ -f "/usr/local/cpanel/cpanel" ]; then
       echo "-" | tee $OUTFILE
              exit
fi


USAGE="fpm_fix domainname"

if ! [ "$1" ] ; then 
        echo "Need the domainnamme"
        exit 1
fi

USER="$1"


if find /var/cpanel/userdata/*/*.php-fpm.yaml | grep $USER ; then 
USERFILE=$(find /var/cpanel/userdata/*/*.php-fpm.yaml | grep $USER)
sed -i 's/pm_process_idle_timeout:.*/pm_process_idle_timeout: 5/' "$USERFILE"
sed -i 's/request_terminate_timeout:.*/request_terminate_timeout: 10/' "$USERFILE"
sed -i 's/pm_max_requests:.*/pm_max_requests: 10000/' "$USERFILE"
fi 
