diff options
Diffstat (limited to 'main/php/php-fpm.initd')
-rw-r--r-- | main/php/php-fpm.initd | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/main/php/php-fpm.initd b/main/php/php-fpm.initd index fec658935f..f8f0215512 100644 --- a/main/php/php-fpm.initd +++ b/main/php/php-fpm.initd @@ -1,7 +1,10 @@ #!/sbin/runscript PHP_FPM_CONF="/etc/php/php-fpm.conf" +pidfile="/var/run/php-fpm.pid" +command=/usr/bin/php-fpm +extra_commands="depend" extra_started_commands="reload" depend() { @@ -10,13 +13,28 @@ depend() { } start() { - ebegin "Starting PHP FastCGI server" - start-stop-daemon --start --exec /usr/bin/php-fpm -- -y "${PHP_FPM_CONF}" - eend $? + ebegin "Starting PHP FastCGI Process Manager" + start-stop-daemon --start --pidfile ${pidfile} --exec ${command} \ + -- --fpm-config "${PHP_FPM_CONF}" --pid "${pidfile}" + local i=0 + local timeout=50 + while [ ! -f ${pidfile} ] && [ $i -le $timeout ]; do + sleep 0.1 + i=$(($i + 1)) + done + + [ $timeout -gt $i ] + eend $? } stop() { - ebegin "Stopping PHP FastCGI server" - start-stop-daemon --stop --name php-fpm - eend $? + ebegin "Stopping PHP FastCGI Process Manager" + start-stop-daemon --signal QUIT --stop --pidfile ${pidfile} + eend $? +} + +reload() { + ebegin "Reloading PHP FastCGI Process Manager" + [ -f ${pidfile} ] && kill -USR2 $(cat ${pidfile}) + eend $? } |