#
# check if named process ($1) exist, raise flag if there is none or more
# then one process.
#

progname=$(basename $0)
function usage() {
	echo "$progname process_name"
	exit 0
}

if [ "$#" != "1" ]
then 
	usage
fi
	
proc_name=$1

# "ps -e o ucomm" displays a list of simple process command name
count=$(ps -e o ucomm | cut "-d " -f1 | grep "$proc_name" | wc -l )

(( $count == 0 )) && exit 1		## nothing matches
(( $count == 1 )) && exit 0		## ok
exit 2					## more than 1

