diff options
author | Ole Markus With <olemarkus@gentoo.org> | 2011-11-18 08:41:13 +0000 |
---|---|---|
committer | Ole Markus With <olemarkus@gentoo.org> | 2011-11-18 08:41:13 +0000 |
commit | 5a36a0fd3f9283a4d0d75e8e38c8c8e671756b53 (patch) | |
tree | d082bb221c93c8009749d1e7b56fbbb64b9a1fbc /dev-lang | |
parent | Version bump, drop old (diff) | |
download | gentoo-2-5a36a0fd3f9283a4d0d75e8e38c8c8e671756b53.tar.gz gentoo-2-5a36a0fd3f9283a4d0d75e8e38c8c8e671756b53.tar.bz2 gentoo-2-5a36a0fd3f9283a4d0d75e8e38c8c8e671756b53.zip |
Fixed init script for multislotting. Bug 390307. Thanks to Guillaume Castagnino and Piotr Karbowski for input
(Portage version: 2.2.0_alpha71/cvs/Linux x86_64)
Diffstat (limited to 'dev-lang')
-rw-r--r-- | dev-lang/php/ChangeLog | 6 | ||||
-rwxr-xr-x | dev-lang/php/files/php-fpm.init | 41 |
2 files changed, 38 insertions, 9 deletions
diff --git a/dev-lang/php/ChangeLog b/dev-lang/php/ChangeLog index eb4b5c8b7f36..184804eed306 100644 --- a/dev-lang/php/ChangeLog +++ b/dev-lang/php/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for dev-lang/php # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.521 2011/11/11 13:18:38 olemarkus Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.522 2011/11/18 08:41:13 olemarkus Exp $ + + 18 Nov 2011; Ole Markus With <olemarkus@gentoo.org> files/php-fpm.init: + Fixed init script for multislotting. Bug 390307. Thanks to Guillaume + Castagnino and Piotr Karbowski for input 11 Nov 2011; Ole Markus With <olemarkus@gentoo.org> -php-5.4.0_beta2.ebuild: Removed beta of 5.4 diff --git a/dev-lang/php/files/php-fpm.init b/dev-lang/php/files/php-fpm.init index adcfd3275bbb..a186d83478c5 100755 --- a/dev-lang/php/files/php-fpm.init +++ b/dev-lang/php/files/php-fpm.init @@ -1,8 +1,15 @@ #!/sbin/runscript -PHP_FPM_CONF="/etc/php/fpm-php5/php-fpm.conf" +set_phpvars() { + PHPSLOT=${SVCNAME#php-fpm-} + [ ${PHPSLOT} = 'php-fpm' ] && PHPSLOT="$(eselect php show fpm)" -opts="depend start stop reload" + PHP_FPM_CONF="/etc/php/fpm-${PHPSLOT}/php-fpm.conf" + PHP_FPM_PID="/var/run/php-fpm-${PHPSLOT}.pid" +} + +extra_commands="depend" +extra_started_commands="reload" depend() { need net @@ -10,13 +17,31 @@ 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" + set_phpvars + start-stop-daemon --start --pidfile ${PHP_FPM_PID} --exec \ + /usr/lib/${PHPSLOT}/bin/php-fpm -- -y "${PHP_FPM_CONF}" -g "${PHP_FPM_PID}" + local i=0 + local timeout=5 + while [ ! -f ${PHP_FPM_PID} ] && [ $i -le $timeout ]; do + sleep 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" + set_phpvars + start-stop-daemon --signal QUIT --stop --exec /usr/lib/${PHPSLOT}/bin/php-fpm --pidfile ${PHP_FPM_PID} + eend $? +} + +reload() { + ebegin "Reloading PHP FastCGI Process Manager" + set_phpvars + [ -f ${PHP_FPM_PID} ] && kill -USR2 $(cat ${PHP_FPM_PID}) + eend $? } |