#!/bin/bash
#
# The monitor url can look something like http://192.168.1.155, or
# something linke http://radiationMonitor.domain.com depending on
# whether your local network uses a domain name server.
#
MONITOR_URL="{your monitor url}"

APP_PATH="/home/$USER/bin"
LOG_PATH="/home/$USER/log"

PROCESS_ID="$(ps x | awk '/[r]admonAgent.py/{print $1}')"

if [ -n "$PROCESS_ID" ]; then
  if [ "$1" != "-q" ]; then
    printf "radmon agent running [%s]\n" $PROCESS_ID
  fi
else
  printf "starting up radmon agent\n"
  cd $APP_PATH
  ./radmonAgent.py -t 10 -u $MONITOR_URL >> $LOG_PATH/radmonAgent.log 2>&1 &
fi