Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix bug#64764: Add status option to fpm init.d script #346

Closed
wants to merge 1 commit into from

3 participants

@kaplanlior

No description provided.

@Majkl578 Majkl578 commented on the diff
sapi/fpm/init.d.php-fpm.in
@@ -91,6 +91,20 @@ case "$1" in
fi
;;
+ status)
+ if [ ! -r $php_fpm_PID ] ; then
+ echo "php-fpm is stopped"

"not running" would be better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Majkl578 Majkl578 commented on the diff
sapi/fpm/init.d.php-fpm.in
@@ -91,6 +91,20 @@ case "$1" in
fi
;;
+ status)
+ if [ ! -r $php_fpm_PID ] ; then
+ echo "php-fpm is stopped"
+ exit 0
+ fi
+
+ PID=`cat $php_fpm_PID`
+ if ps -p $PID | grep -q $PID; then
+ echo "php-fpm (pid $PID) is running..."
+ else
+ echo "php-fpm dead but pid file exists"

"not running" would be better than "dead"

The phrases were taken from RHEL/Centos lsb messages to be aligned with other daemons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@php-pulls
Collaborator

Comment on behalf of stas at php.net:

merged

@php-pulls php-pulls closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 1 deletion.
  1. +15 −1 sapi/fpm/init.d.php-fpm.in
View
16 sapi/fpm/init.d.php-fpm.in
@@ -91,6 +91,20 @@ case "$1" in
fi
;;
+ status)
+ if [ ! -r $php_fpm_PID ] ; then
+ echo "php-fpm is stopped"

"not running" would be better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ exit 0
+ fi
+
+ PID=`cat $php_fpm_PID`
+ if ps -p $PID | grep -q $PID; then
+ echo "php-fpm (pid $PID) is running..."
+ else
+ echo "php-fpm dead but pid file exists"

"not running" would be better than "dead"

The phrases were taken from RHEL/Centos lsb messages to be aligned with other daemons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ fi
+ ;;
+
force-quit)
echo -n "Terminating php-fpm "
@@ -131,7 +145,7 @@ case "$1" in
;;
*)
- echo "Usage: $0 {start|stop|force-quit|restart|reload}"
+ echo "Usage: $0 {start|stop|force-quit|restart|reload|status}"
exit 1
;;
Something went wrong with that request. Please try again.