#!/bin/sh

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

exit 0
