hmm, I think I see the Problem:
$ ps awuxfo command | grep spam
root 8283 2.6 1.3 29112 27516 ?? S 11:33AM 0:47.60 spamd child (per spamd child (perl)
root 5965 0.0 1.0 23056 20416 ?? Ss Mon07AM 0:36.53 /usr/bin/spamd - /usr/bin/spamd -d --allowed-ips=127.0.0.1 --pidfi
root 44032 0.0 1.0 23056 20456 ?? S 12:20PM 0:00.00 spamd child (per spamd child (perl)
When I use the "c"-Option, then only "perl" is displayed. I've now modified the Check Process Script as the follow:
Code: Select all
#!/bin/sh
if [ $# -ge 2 ]
then
OS=`uname`
case $OS in
Linux) PSLIST='ps -eo ucmd';;
FreeBSD) PSLIST='ps awuxo command | grep';;
SunOS) PSLIST='ps -eo fname';;
*) echo 'ScriptRes:Unknown:script is not designed for '$OS
exit;;
esac
$PSLIST | awk 'BEGIN { cnt=0 } $1=="'$1'"{cnt++} \
END {if (cnt='$2') {printf("ScriptRes:Ok:%d\n",cnt)} else {printf("ScriptRes:Bad:%d\n",cnt)} }'
else
echo 'ScriptRes:Unknown:not enough parameters specified'
fi
What I want to do? I'd like to Check if the Process "/usr/bin/spamd" is running at the minimum one time.