Projet

Général

Profil

Révision 361a5316

ID361a5316c75625639f0014fdcfba14829998c74a
Parent 12045d80
Enfant 123d91cf

Ajouté par Jens Jahnke il y a plus de 13 ans

Don't use hard coded paths to the used command line tools.

The tools grep, sed and wc may have a different path. Therefore
they are now evaluated via "which". If a command is not found the script
exits with an error message and the exit code 1.

Voir les différences:

plugins/php/php-cgi
32 32
exit 0
33 33
fi
34 34

  
35
CMD_GREP=`which grep`
36
if [ ! -e ${CMD_GREP} ]; then
37
  echo "Command grep (${CMD_GREP}) not found!"
38
  exit 1
39
fi
40
CMD_SED=`which sed`
41
if [ ! -e ${CMD_SED} ]; then
42
  echo "Command sed (${CMD_SED}) not found!"
43
  exit 1
44
fi
45
CMD_WC=`which wc`
46
if [ ! -e ${CMD_WC} ]; then
47
  echo "Command wc (${CMD_WC}) not found!"
48
  exit 1
49
fi
50

  
35 51
echo -n "php_processes.value "
36
/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/ *//'
52
/bin/ps ax | ${CMD_GREP} -i php-cgi | ${CMD_GREP} -v grep | ${CMD_WC} -l | ${CMD_SED} 's/\t +//' | ${CMD_SED} 's/ *//'

Formats disponibles : Unified diff