diff --git a/plugins/php/php-cgi b/plugins/php/php-cgi index a761f9eb..0aa81748 100755 --- a/plugins/php/php-cgi +++ b/plugins/php/php-cgi @@ -32,5 +32,21 @@ echo 'php_processes.info The current number of php-cgi processes.' exit 0 fi +CMD_GREP=`which grep` +if [ ! -e ${CMD_GREP} ]; then + echo "Command grep (${CMD_GREP}) not found!" + exit 1 +fi +CMD_SED=`which sed` +if [ ! -e ${CMD_SED} ]; then + echo "Command sed (${CMD_SED}) not found!" + exit 1 +fi +CMD_WC=`which wc` +if [ ! -e ${CMD_WC} ]; then + echo "Command wc (${CMD_WC}) not found!" + exit 1 +fi + echo -n "php_processes.value " -/bin/ps ax | /usr/bin/grep -i php-cgi | /usr/bin/grep -v grep | /usr/bin/wc -l | /usr/bin/sed 's/\t +//' | /usr/bin/sed 's/ *//' +/bin/ps ax | ${CMD_GREP} -i php-cgi | ${CMD_GREP} -v grep | ${CMD_WC} -l | ${CMD_SED} 's/\t +//' | ${CMD_SED} 's/ *//'