Folgendes Script gibt den Wert "10" zurück:
Code: Alles auswählen
#!/bin/bash
RESULT=`ps -ef | grep "slapd" | grep -v grep | wc -l`
echo $RESULT
Code: Alles auswählen
mail:/tmp # ps -ef | grep "slapd" | grep -v grep | wc -l
Code: Alles auswählen
#!/bin/bash
RESULT=`ps -ef | grep "slapd" | grep -v grep | wc -l`
echo $RESULT
Code: Alles auswählen
mail:/tmp # ps -ef | grep "slapd" | grep -v grep | wc -l
Code: Alles auswählen
#!/bin/bash
RESULT=`ps -ef | grep "slapd" | grep -v grep | tee /dev/stderr | wc -l`
echo $RESULT
Code: Alles auswählen
mail:/tmp # ./slapd_check2
root 6070 1 0 12:48 ? 00:00:00 /usr/lib/openldap/slapd
root 6071 6070 0 12:48 ? 00:00:00 /usr/lib/openldap/slapd
root 6072 6071 0 12:48 ? 00:00:01 /usr/lib/openldap/slapd
root 6074 6071 0 12:49 ? 00:00:24 /usr/lib/openldap/slapd
root 6075 6071 0 12:49 ? 00:00:19 /usr/lib/openldap/slapd
root 6078 6071 0 12:49 ? 00:00:19 /usr/lib/openldap/slapd
root 6079 6071 0 12:49 ? 00:00:22 /usr/lib/openldap/slapd
root 6656 6071 0 13:38 ? 00:00:05 /usr/lib/openldap/slapd
root 6677 6071 0 13:40 ? 00:00:05 /usr/lib/openldap/slapd
root 6845 6071 0 13:50 ? 00:00:02 /usr/lib/openldap/slapd
root 7028 6813 0 14:04 pts/1 00:00:00 /bin/bash ./slapd_check2
root 7029 7028 0 14:04 pts/1 00:00:00 /bin/bash ./slapd_check2
12