#!/bin/sh pid_list="$(ps aux | grep ipfcst-spare2 | grep -v grep | awk '{print $2}')" pid_count=$(echo $pid_list | wc -w) if test $pid_count -eq 1; then echo "spare2 running, pid is $pid_list" exit 0 elif test $pid_count -gt 1; then echo "Multiple spare2 running $pid_list" exit 1 elif test -z $pid_list; then echo "spare2 is not running" exit 1 fi exit 0