status-monitor.sh 376 B

12345678910111213141516
  1. #!/bin/sh
  2. pid_list="$(ps aux | grep ipfcst-monitor | grep -v grep | awk '{print $2}')"
  3. pid_count=`echo $pid_list | wc -w`
  4. if test $pid_count -eq 1 ; then
  5. echo "Monitor running, pid is $pid_list"
  6. exit 0
  7. elif test $pid_count -gt 1 ; then
  8. echo "Multiple Monitor running $pid_list"
  9. exit 1
  10. elif test -z $pid_list ; then
  11. echo "Monitor is not running"
  12. exit 1
  13. fi
  14. exit 0