Index: trunk/MagicSoft/Mars/datacenter/scripts/dowebplots
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/dowebplots	(revision 7938)
+++ trunk/MagicSoft/Mars/datacenter/scripts/dowebplots	(revision 7944)
@@ -32,20 +32,12 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=dowebplots
-source `dirname $0`/sourcefile
 
 set -C
 
-cd $mars
-
-datetime=`date +%F-%H-%M-%S`
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-
-scriptlog=$scriptlogpath/dowebplots-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
-
 
 while getopts p: opts
@@ -65,11 +57,11 @@
    echo "usage: $(basename $0) -p programname"   >> $scriptlog 2>&1
    date  >> $scriptlog 2>&1
+   printprocesslog "INFO finished $0"
    exit
 fi
 
 # check if script is already running
-lockfile=$lockpath/lock-dowebplots-$type.txt
+lockfile=$lockpath/lock-$program-$type.txt
 checklock  >> $scriptlog 2>&1
-
 
 #finding all rootfiles in the data directory, that were modified in the last 3 days
@@ -81,11 +73,12 @@
 then 
    echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   rm -v $lockfile >> $scriptlog 2>&1
-   date  >> $scriptlog 2>&1
-   exit
+   finish >> $scriptlog 2>&1
 fi
 
 
+cd $mars
+
 #produce plots for each rootfile
+printprocesslog "INFO procduing plots for each $type rootfile"
 for rootfile in ${rootfiles[@]}
 do 
@@ -120,4 +113,5 @@
    fi
 
+   printprocesslog "INFO procduing plots for $rootfile"
    echo "producing psfile..." >> $scriptlog 2>&1
    ./showplot -b --save-as-ps=$psfile $rootfile >> $scriptlog 2>&1
@@ -135,8 +129,4 @@
 done
 
-rm -v $lockfile >> $scriptlog 2>&1 
+finish >> $scriptlog 2>&1
 
-set +C
-
-date  >> $scriptlog 2>&1
-
