SOURCES: php-fcgi.init - no sleeping between restart (assume fcgi-...
glen
glen at pld-linux.org
Thu Nov 8 00:29:25 CET 2007
Author: glen Date: Wed Nov 7 23:29:25 2007 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- no sleeping between restart (assume fcgi-graceful patch applied or pure luck)
- use read VAR instead of subshell with cat to read pids
- do not use daemon() as it wastes time in initlog/log_success
---- Files affected:
SOURCES:
php-fcgi.init (1.20 -> 1.21)
---- Diffs:
================================================================
Index: SOURCES/php-fcgi.init
diff -u SOURCES/php-fcgi.init:1.20 SOURCES/php-fcgi.init:1.21
--- SOURCES/php-fcgi.init:1.20 Wed Oct 3 11:29:01 2007
+++ SOURCES/php-fcgi.init Thu Nov 8 00:29:20 2007
@@ -100,9 +100,14 @@
args="$args ${SPAWN_SOCKET:+-s $SPAWN_SOCKET}"
args="$args $SPAWNARGS"
- daemon /usr/sbin/spawn-fcgi -P /var/run/php-fcgi.pid $args -f $PHP_FCGI_BINARY -C $PHP_FCGI_CHILDREN
+ /usr/sbin/spawn-fcgi -P /var/run/php-fcgi.pid $args -f $PHP_FCGI_BINARY -C $PHP_FCGI_CHILDREN 2> /dev/null
RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/php-fcgi
+ if [ $RETVAL -eq 0 ]; then
+ ok
+ touch /var/lock/subsys/php-fcgi
+ else
+ fail
+ fi
}
# Stops FCGI.
@@ -135,13 +140,12 @@
}
restart() {
-
local stop socket oldpid newpid
# we need to know about stopping before we start
if [ -f /var/lock/subsys/php-fcgi ]; then
stop=1
- oldpid=$(cat /var/run/php-fcgi.pid)
+ read oldpid 2>/dev/null </var/run/php-fcgi.pid
fi
# so if we're using local sockets, we can create the new processes before
@@ -159,12 +163,8 @@
mv -f "$SPAWN_SOCKET" "$socket"
# to prevent killing the newly spawned process we restore pid of old fcgi
- newpid=$(cat /var/run/php-fcgi.pid)
+ read newpid 2>/dev/null </var/run/php-fcgi.pid
echo "$oldpid" > /var/run/php-fcgi.pid
- sleep=10
- show "Waiting %d seconds before killing old process" $sleep
- sleep $sleep
- ok
fi
fi
@@ -206,7 +206,7 @@
echo " PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN"
echo " FCGI_WEB_SERVER_ADDRS=$FCGI_WEB_SERVER_ADDRS"
echo " PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS"
- pid=$(cat /var/run/php-fcgi.pid 2>/dev/null)
+ read pid 2>/dev/null </var/run/php-fcgi.pid
if [ -f "/proc/$pid/environ" ]; then
echo "Running settings:"
tr '\0' '\n' < /proc/$pid/environ | awk -F= '
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/php-fcgi.init?r1=1.20&r2=1.21&f=u
More information about the pld-cvs-commit
mailing list