anchor.diff:          ;;
       stop)
           if [ "" = "$FOUND_PID" ]; then
  -            echo "Service not running? File $LOG_PID not exist."
  +            echo "Service not running, nothing to stop."
               exit 1
           else
               kill $FOUND_PID
  -            sleep 2
  -            FOUND_PID=`ps -ef |grep $MAIN |grep -v grep |awk {print $2}'`
  +            sleep 4
  +            # Find PID again to see if we need to use kill -9 termination.
  +            FOUND_PID=`ps -ef |grep $MAIN |grep -v grep |awk '{print $2}'`
               if [ "" != "$FOUND_PID" ]; then
  -                echo "Sending kill -9 to process."
  +                echo "Using kill did not work, sending kill -9 to process."
                   kill -9 $FOUND_PID
               fi
  +            exit 0
           fi 
           ;;
       status)
  
positive.code:         if [ "" = "$FOUND_PID" ]; then
              cd   $HOME_DIR
              echo $CMD $MAIN
              exec $CMD $MAIN >$LOG_OUT 2>$LOG_ERR &
          else 
              echo "Service already running!"
              exit 1
  
negative.code: CMD="$JAVA_HOME/bin/java -cp $CP -Dcom.webtrends.log.dir=<%=@log_dir%> $JMX_OPTS"
  
  # Find current PID if any.
  FOUND_PID=`ps -ef |grep $MAIN |grep -v grep |awk '{print $2}'`
  
  # Check what the caller wants.
  case "$1" in
  