Projet

Général

Profil

Révision d0d36f49

IDd0d36f4926ee0628029c8a6664cac19b0f4413a0
Parent f25c788c
Enfant b6df4bce

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

Use ${CMD_...} only to check if command exists
and use the real command e.g. grep, sed, etc. in the command line.

Voir les différences:

plugins/php/php-cgi
34 34

  
35 35
CMD_GREP=`which grep`
36 36
if [ ! -e ${CMD_GREP} ]; then
37
  echo "Command grep (${CMD_GREP}) not found!"
37
  echo "Command grep not found!"
38 38
  exit 1
39 39
fi
40 40
CMD_SED=`which sed`
41 41
if [ ! -e ${CMD_SED} ]; then
42
  echo "Command sed (${CMD_SED}) not found!"
42
  echo "Command sed not found!"
43 43
  exit 1
44 44
fi
45 45
CMD_WC=`which wc`
46 46
if [ ! -e ${CMD_WC} ]; then
47
  echo "Command wc (${CMD_WC}) not found!"
47
  echo "Command wc not found!"
48 48
  exit 1
49 49
fi
50 50
CMD_AWK=`which awk`
51 51
if [ ! -e ${CMD_AWK} ]; then
52
  echo "Command awk (${CMD_AWK}) not found!"
52
  echo "Command awk not found!"
53 53
  exit 1
54 54
fi
55 55
CMD_BC=`which bc`
56 56
if [ ! -e ${CMD_BC} ]; then
57
  echo "Command bc (${CMD_BC}) not found!"
57
  echo "Command bc not found!"
58 58
  exit 1
59 59
fi
60 60

  
61 61
echo -n "php_cgi_processes.value "
62
ps ax | ${CMD_GREP} -i php-cgi | ${CMD_GREP} -v grep | ${CMD_WC} -l | ${CMD_SED} 's/\t +//' | ${CMD_SED} 's/ *//'
62
ps ax | grep -i php-cgi | grep -v grep | wc -l | sed 's/\t +//' | sed 's/ *//'
63 63

  
64 64
MEMORY=0
65
for mem in `ps avx | ${CMD_GREP} -i php-cgi | ${CMD_GREP} -v grep | ${CMD_GREP} "Ss" | ${CMD_AWK} '{ print $7 }'`; do
65
for mem in `ps avx | grep -i php-cgi | grep -v grep | grep "Ss" | awk '{ print $7 }'`; do
66 66
  MEMORY=$(($MEMORY + $mem))
67 67
done
68 68
echo -n "php_cgi_ram.value "

Formats disponibles : Unified diff