bin/stoprad
b528647b
 #!/bin/bash
207514f1
 # Stop the radmon agent process and clean up environment.
b528647b
 
207514f1
 # Set path to radmon input data file
 RADMON_INPUT_DATA_FILE="/home/$USER/public_html/radmon/dynamic/radmonInputData.dat"
 RADMON_OUTPUT_DATA_FILE="/home/$USER/public_html/radmon/dynamic/radmonOutputData.js"
b528647b
 
 PROCESS_ID="$(ps x | awk '/[r]admonAgent.py/{print $1}')"
207514f1
 
b528647b
 if [ -n "$PROCESS_ID" ]; then
   printf "killing radmon agent [%s]\n" $PROCESS_ID
   kill $PROCESS_ID
207514f1
 
   # Remove input data file to alert mirror servers
   if [ -e $RADMON_INPUT_DATA_FILE ]; then
     rm $RADMON_INPUT_DATA_FILE
   fi
   # Remove output data file to alert web clients
   if [ -e $RADMON_OUTPUT_DATA_FILE ]; then
     rm $RADMON_OUTPUT_DATA_FILE
   fi
b528647b
 else
   echo radmon agent not running
 fi