Commit 0449861a authored by Natanael Copa's avatar Natanael Copa
Browse files

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.
parent 406ee1a6
......@@ -2,7 +2,7 @@
# Maintainer: Matt Smith <mcs@darkregion.net>
pkgname=php
pkgver=5.5.13
pkgrel=0
pkgrel=1
pkgdesc="The PHP language runtime engine"
url="http://www.php.net/"
arch="all"
......@@ -486,17 +486,17 @@ wddx() { _mv_ext wddx; }
opcache() { _mv_ext opcache; }
md5sums="e26e90af25ee6505dc18855e0180ffe9 php-5.5.13.tar.bz2
9ab162ff3428511a68aa9801c746e0d5 php-fpm.initd
2e86e55c29c81282474dea27cc97b873 php-fpm.initd
67719f428f44ec004da18705cbabe2ee php5-module.conf
483bc0a85c50a9a9aedbe14a19ed4526 php-install-pear-xml.patch
162d8d079944387eab2bc80edab347ae gd-iconv.patch"
sha256sums="e58a4a754eb18d2d8b1a120cad5cce4ed24a7db5d49eca5830a40e4c8ca78b9c php-5.5.13.tar.bz2
96e68f7c545adcac56ed1f5824b33041e270680ca884a9cfe27e7f4ac8abfd3b php-fpm.initd
375892c6997f48659f7087ccb7fac039e4bb2f375453247295caa7858b9e15b9 php-fpm.initd
ceec4d5b2a128c6a97e49830af604f0bb555bca1a86a9cd0366b828ba392257f php5-module.conf
f739ca427a1dd53a388bad0823565299c5d4a5796b1171b892884e4d7d099bab php-install-pear-xml.patch
6122bf279cdb7c387dd000761b2426969a73cf63a10a132aa98a79eb1dd259b2 gd-iconv.patch"
sha512sums="0c82635d73b328c5798163dba2b293fc1ad976793a9fac21a36840594c4f26d5a6582ba437f54bfaacf1fde3df2d09366b106bb555cb42a29097e6ad33ac36d9 php-5.5.13.tar.bz2
33247a1c9188eba893bb0be13456eeeec9b971c7f482a4e2bd0f318fb63d8c67d379a021840768bef8e4d630be859c5bdb424c1e90b9b816ec691c078147e915 php-fpm.initd
2d294022f2c45b2f3229655e5883b8ccab6852ed0378df682b9dd85a31038666ad3a622580861ce2d26dedf187326727ecf93694eb716271e9be25f79daddae9 php-fpm.initd
895e94c791bd82060ad820fef049d366a09c932097faa6b7b9a2c2e9e00a18cb7c0f9b128679c7659b404379266fd0f95dba5c0333f626194cf60f7bf6044102 php5-module.conf
f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505 php-install-pear-xml.patch
59443fb464f49ff7d9b64739df982e7240f9d4792226d96ad1538286945125fc7eb6f0cab88b64d5c81ee3679fd89bffdca59ebd20eca2778ab801ee54529028 gd-iconv.patch"
#!/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 $?
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment