[Unit]
Description=Hestia PHP daemon
Documentation=https://www.hestiacp.com
PartOf=hestia.service

[Service]
Type=forking
PIDFile=/run/hestia-php.pid
ExecStart=/usr/local/hestia/php/sbin/hestia-php --fpm-config /usr/local/hestia/php/etc/php-fpm.conf
ExecReload=/bin/sh -c "/bin/kill -s HUP $(/bin/cat /run/hestia-php.pid)"
ExecStop=/usr/bin/php -r '$pid=(int)file_get_contents("/run/hestia-php.pid");posix_kill($pid,SIGTERM);while(posix_kill($pid,0)){sleep(0);}'
ExecStartPre=/bin/bash -c "/bin/systemctl set-environment HOSTNAME=$(/usr/bin/hostname)"
Environment="HESTIA=/usr/local/hestia"

[Install]
WantedBy=hestia.service
