#!/bin/sh

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

exit 0
