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:16:29 +0000 |
commit | 0449861a8f541e2091c0e4b049682f8deee67333 (patch) | |
tree | 5ae86e596a618c5b83a22851a3959586b57e720d /main/php/php-fpm.initd | |
parent | 406ee1a6c696f0547bbd2a4bbda4811df89cf224 (diff) | |
download | aports-0449861a8f541e2091c0e4b049682f8deee67333.tar.bz2 aports-0449861a8f541e2091c0e4b049682f8deee67333.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.
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 $? } |