Index: trunk/MagicSoft/Mars/datacenter/scripts/doexclusions
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/doexclusions	(revision 7265)
+++ trunk/MagicSoft/Mars/datacenter/scripts/doexclusions	(revision 7460)
@@ -20,9 +20,18 @@
 #   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
 #
-#   Copyright: MAGIC Software Development, 2000-2004
+#   Copyright: MAGIC Software Development, 2000-2006
 #
 #
 # ========================================================================
 #
+# This script launches the excluding of runs for all days for which 
+# this step is needed. 
+#
+# After checking, if the script is already running, the todolist is 
+# written by using the macro getdolist.C
+# Then the run are excluded for each date in the todolist using the 
+# macro doexclusions.C
+# If this was successful, the status is inserted into the database using 
+# the macro setstatus.C
 #
 
@@ -46,5 +55,4 @@
 scriptlogpath=$logpath/run/doexclusions/`date +%Y/%m`
 makedir $scriptlogpath
-
 scriptlog=$scriptlogpath/doexclusions-$datetime.log
 
@@ -53,4 +61,5 @@
 makedir $getstatuslogpath >> $scriptlog 2>&1
 
+# check if the script is already running
 date > $lockpath/lock-doexclusions.txt >> $scriptlog 2>&1 
 checklock0=$?
@@ -64,5 +73,5 @@
 esac
 
-
+# get the todo list
 echo "getting list..." >> $scriptlog 2>&1
 check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`
@@ -70,9 +79,12 @@
 case $check0 in 
    1)   echo "check0=$check0 -> everything ok -> do step" >> $scriptlog 2>&1;;
-   *)   echo "check0=$check0 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
+   *)   echo "check0=$check0 -> ERROR -> could not get todo list -> exit" >> $scriptlog 2>&1
+	rm -v $todofile >> $scriptlog 2>&1
+   	rm -v $lockpath/lock-doexclusions.txt >> $scriptlog 2>&1
+	date  >> $scriptlog 2>&1
+	exit;;
 esac
 
 dates=(`cat $todofile`)
-
 if [ "$dates" = "" ]
 then 
@@ -84,6 +96,6 @@
 fi
 
+# do exclusions for each date in the todo file
 echo "dates: "${dates[@]} >> $scriptlog 2>&1
-
 for date in ${dates[@]}
 do 
