Index: trunk/DataCheck/Transfer/BackupRawToWue.sh
===================================================================
--- trunk/DataCheck/Transfer/BackupRawToWue.sh	(revision 15595)
+++ trunk/DataCheck/Transfer/BackupRawToWue.sh	(revision 15596)
@@ -9,10 +9,16 @@
 set -C
 
+# checking that not more than $numrsyncwuelimit 
+#  instances of the script are running
+numrsyncwue=`lsof $0 | grep -o -c $0`
+echo "-"$numrsyncwue"-"
+if [ $numrsyncwue -gt $numrsyncwuelimit ]
+then
+   echo "INFO already "$numrsyncwue" BackupRawToWue.sh running -> exit. "
+   finish
+fi
+
 logfile=$runlogpath"/RsyncRawToWue-"$datetime".log"
 date >> $logfile
-
-# check if script is already running
-lockfile=$lockpath/lock-$program.txt
-checklock 
 
 # get todo list
@@ -27,4 +33,9 @@
    
    setstatus "start" 
+   if [ $numchanged -eq 0 ]
+   then
+      printprocesslog "INFO "$numchanged" rows were changed in DB => "$night"_"$runid" is already processed => continue."
+      continue
+   fi
 
    rawdirisdc="/scratch/from_lapalma/raw"
