#!/bin/sh

if [ $# -ne 2 ]
then
    echo "usage: $0 temperature A/B "; exit 1
fi

echo 
echo starting multimon.py at `date`
echo 

dtsxinit
#database="fat-dbs"
#computers="mdfl1-hub1"

cd $HOME/Results/Monitoring/

mkdir $1$2
cd $1$2

echo `date` $1$2 $FAT_NDOMS >> log.txt

year=$(date +%Y)
month=$(date +%m)
day=$(date +%d)
hour=$(date +%H)
minute=$(date +%M)
echo ' ' > StartTime.$year-$month-$day.$hour.$minute 
if [ "$1" == "DEAD" ]
then
 nohup multimon-with-deadtime.py -H $FAT_DB -S normalFAT -o $HOME/Results/Monitoring/$1$2 $FAT_HUB &
fi

if [ "$1" == "5E" ]
then
	nohup ~/bin/multimon.py -g 5 -c 675  -H $FAT_DB -S normalFAT -o $HOME/Results/Monitoring/$1$2 $FAT_HUB &
	echo  nohup ~/bin/multimon.py -g 5 -c 675  -H $FAT_DB -S normalFAT -o $HOME/Results/Monitoring/$1$2 $FAT_HUB &
fi

if [ "$1" != "5E" ]
then
if [ "$1" != "DEAD" ]
then
	nohup ~/bin/multimon.py -H $FAT_DB -S normalFAT -o $HOME/Results/Monitoring/$1$2 $FAT_HUB &
	echo nohup ~/bin/multimon.py -H $FAT_DB -S normalFAT -o $HOME/Results/Monitoring/$1$2 $FAT_HUB &
fi
fi
~/hagar/monitoring-loop FAT_NDOMS




