systemd 825 B

12345678910111213141516171819202122232425
  1. service_name=php
  2. unit_file=./sapi/fpm/php-fpm.service
  3. [[ $sysinit_versioned == true ]] && \
  4. service_name=$(echo $php_mayor_revision|sed -r 's/[-\.x]//g')
  5. if [ -d /usr/lib/systemd/system ]; then
  6. systemd_unit=/usr/lib/systemd/system
  7. elif [ -d /lib/systemd/system ]; then
  8. systemd_unit=/lib/systemd/system
  9. else
  10. echo Unable to locate systemd dir!
  11. exit;
  12. fi
  13. systemd_unit=${systemd_unit}/${service_name}-fpm.service
  14. $userdo cp -v $unit_file $systemd_unit
  15. #
  16. # Replace PID file to allow several PHP versions
  17. [[ $sysinit_versioned == true ]] && \
  18. sed -r -i "s/PIDFile=\/var\/run\/php-fpm.pid/PIDFile=\/var\/run\/${service_name}-fpm.pid/" $systemd_unit
  19. #
  20. # Enable and start the unit
  21. $userdo systemctl enable ${service_name}-fpm && \
  22. $userdo systemctl start ${service_name}-fpm && \
  23. $userdo systemctl status ${service_name}-fpm