diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-06-19 07:13:19 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-06-19 07:27:46 +0000 |
commit | 0b27b4f563b0ade438f24589d0bc413a25f8e77e (patch) | |
tree | 47cb9cc0e4c22b6761206bb8c053e69ee61b6407 /main/php/php-fpm.initd | |
parent | f202c41cce97650c6c9077d80fc60590a22350de (diff) | |
download | aports-0b27b4f563b0ade438f24589d0bc413a25f8e77e.tar.bz2 aports-0b27b4f563b0ade438f24589d0bc413a25f8e77e.tar.xz |
main/php: fix php-fpm script
ref #2685
The problem was that it usesd start-stop-daemon --exec but the argv[0]
name didnt correpond so start-stop-daemon could not know that it was up
and running.
The fix is to use pidfile.
Script is based on update from gentoo.
(cherry picked from commit 0449861a8f541e2091c0e4b049682f8deee67333)
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 fec658935..f8f021551 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 $? } |