Da bich noch mal,
ich habe das Script umgestellt.
PHP:
#!/bin/bash
tom=ps -ef | grep tomcat | wc -l
echo Ergebnis = $tom
if [ $tom < 2 ]
then echo 'PROZ ERROR: 0 Tomcat ist nicht gestartet'
elif [ $tom = 2 ]
then echo 'PROZ OK: Tomcat läuft'
else echo 'PROCS CRITICAL: mehr als 1 Prozess gestartet'
fi
als Rückgabe habe ich:
./check_tomcat: line 5: tom: command not found
0
Ergebnis =
./check_tomcat: line 10: 2: Datei oder Verzeichnis nicht gefunden
./check_tomcat: line 12: [: =: unary operator expected
PROCS CRITICAL: < 1 Prozess gestartet
wenn ich den PS-Befehl in '' schreibe bekomme ich in $tom nur die Befehlszeile ausgegeben.
Ergebnis = ps -ef | grep tomcat | wc -l