arednsig/bin/ardstop
11c3de66
 #!/bin/bash
c8990e85
 # Stop the radmon agent process.
11c3de66
 
c8990e85
 if [ "$HOSTNAME" == "raspi3" ]; then
   AGENT_NAME="[a]rednsigMirrorAgent.py"
 elif [ "$HOSTNAME" == "redwall" ]; then
   AGENT_NAME="[a]rednsigMirrorAgent.py"
 elif [ "$HOSTNAME" == "ka7jlo-web" ]; then
   AGENT_NAME="[a]rednsigAgent.py"
 else
   echo invalid host
   exit 1
 fi
11c3de66
 
 PROCESS_ID="$(ps x | awk -v a=$AGENT_NAME '$7 ~ a {print $1}')"
 
 if [ -n "$PROCESS_ID" ]; then
   printf "killing arednsig agent [%s]\n" $PROCESS_ID
   kill $PROCESS_ID
 else
   echo arednsig agent not running
 fi