Skip to content

Instantly share code, notes, and snippets.

@rendicott rendicott/
Last active Jan 4, 2017

What would you like to do?
quick dirty bash script to see if there's a running process of the given name with Nagios style return codes
# Thanks to androidyue on stackoverflow
ps_out=`ps -ef | grep $1 | grep -v 'grep' | grep -v $0`
result=$(echo $ps_out | grep "$1")
if [[ "$result" != "" ]];then
echo "$1 Running"
exit 0
echo "$1 Not Running"
exit 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.