summaryrefslogtreecommitdiff
path: root/extra/php/rc.d.php-fpm
diff options
context:
space:
mode:
authorroot <root@rshg047.dnsready.net>2011-04-10 04:43:11 +0000
committerroot <root@rshg047.dnsready.net>2011-04-10 04:43:11 +0000
commit8f6922302486fa1cc1112ff8b3daddb48c3260f2 (patch)
treecdd13036f76c8a9b8efcc83bbaea166cc929a527 /extra/php/rc.d.php-fpm
parentf87ab435eb966ec44eb006c48699e6ee90613286 (diff)
Sun Apr 10 04:43:11 UTC 2011
Diffstat (limited to 'extra/php/rc.d.php-fpm')
-rw-r--r--extra/php/rc.d.php-fpm34
1 files changed, 28 insertions, 6 deletions
diff --git a/extra/php/rc.d.php-fpm b/extra/php/rc.d.php-fpm
index 35cf35652..54bcf4d5b 100644
--- a/extra/php/rc.d.php-fpm
+++ b/extra/php/rc.d.php-fpm
@@ -6,9 +6,7 @@
wait_for_pid () {
try=0
-
while test $try -lt 35 ; do
-
case "$1" in
'created')
if [ -f "$2" ] ; then
@@ -16,7 +14,6 @@ wait_for_pid () {
break
fi
;;
-
'removed')
if [ ! -f "$2" ] ; then
try=''
@@ -28,15 +25,38 @@ wait_for_pid () {
stat_append '.'
try=`expr $try + 1`
sleep 1
-
done
-
}
-[ -d /var/run/php-fpm ] || install -d -m755 /var/run/php-fpm
+test_config() {
+ stat_busy 'Checking configuration'
+ if [ $(id -u) -ne 0 ]; then
+ stat_append '(This script must be run as root)'
+ stat_die
+ fi
+
+ if [ ! -r /etc/php/php-fpm.conf ]; then
+ stat_append '(/etc/php/php-fpm.conf not found)'
+ stat_die
+ fi
+
+ local test=$(/usr/sbin/php-fpm -t 2>&1)
+ if [ $? -gt 0 ]; then
+ stat_append '(error in /etc/php/php-fpm.conf)'
+ stat_die
+ elif echo $test | grep -qi 'error'; then
+ stat_append '(error in /etc/php/php.ini)'
+ stat_die
+ fi
+
+ [ -d /var/run/php-fpm ] || install -d -m755 /var/run/php-fpm
+
+ stat_done
+}
case "$1" in
start)
+ test_config
stat_busy 'Starting php-fpm'
/usr/sbin/php-fpm
@@ -58,6 +78,7 @@ case "$1" in
;;
stop)
+ test_config
stat_busy 'Gracefully shutting down php-fpm'
if [ ! -r /var/run/php-fpm/php-fpm.pid ] ; then
@@ -105,6 +126,7 @@ case "$1" in
;;
reload)
+ test_config
stat_busy 'Reload service php-fpm'
if [ ! -r /var/run/php-fpm/php-fpm.pid ] ; then