Index: trunk/DataCheck/DataCheck/PlotRatescans.sh
===================================================================
--- trunk/DataCheck/DataCheck/PlotRatescans.sh	(revision 18212)
+++ trunk/DataCheck/DataCheck/PlotRatescans.sh	(revision 18213)
@@ -4,26 +4,28 @@
 printprocesslog "INFO starting $0 $1"
 
-# get current hour
-hour=`date +%k`
-
-# define dates depending on the time
-if [ $hour -lt 9 ] || [ $hour -gt 19 ]
+# get dates
+if [ "$certaindate" != "" ]
 then
-   # get current night
-   dates=( `date +%Y/%m/%d --date="-12hour"` )
+   checkstring=`echo $certaindate | grep -E -o '^20[0-9][0-9]\/[01][0-9]\/[0-3][0-9]$'\|'^[0-9][0-9][0-9]$'`
+   if [ "$checkstring" = "" ]
+   then
+      echo "Please give the variable certaindate in the correct format (YYYY/MM/DD)"
+      finish
+   fi
+   getdates $certaindate
 else
-   # get last 3, 6 or 9 nights
-   dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
-           `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
-           `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
-           )
+   if [ "$1" = "" ]
+   then 
+      # get last 6 nights if hour between 7 and 19h, else only current night
+      getdates 3 7 19
+   else
+      getdates $1
+   fi
 fi
 
 # for testing only
-anapath=/daq/analysis
+anapath=/loc_data/analysis
 
-mars=/home/fact/SW.automatic.processing/Mars.svn.2013.04.29
 cd $mars
-
 
 for date in ${dates[@]}
@@ -32,5 +34,6 @@
    makedir $outpath
    date2=`echo $date | sed -e 's/\///g'`
-   echo "root -q -b fact/plots/plotratescan.C\("\"$date2\""\) | tee $logfile | intgrep"
+   logfile=$outpath/$date2.log
+   printprocesslog "INFO root -q -b fact/plots/plotratescan.C\("\"$date2\""\) | tee $logfile | intgrep"
    check1=`root -q -b fact/plots/plotratescan.C\("\"$date2\""\) | tee $logfile | intgrep`
    
@@ -41,7 +44,4 @@
            ;;
    esac
-
-   printprocesslog "INFO rsync output to gate."
-   rsync -avn $anapath/ratescans/ gate:/home/factwww/ratescans
 done
 
