Index: trunk/MagicSoft/Mars/datacenter/scripts/insertsequences
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/insertsequences	(revision 7938)
+++ trunk/MagicSoft/Mars/datacenter/scripts/insertsequences	(revision 7944)
@@ -33,23 +33,15 @@
 # 
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=insertsequences
-source `dirname $0`/sourcefile
 
 set -C
 
-cd $mars
-
-datetime=`date +%F-%H-%M-%S`
-year=`date +%Y`
-lockfile=$lockpath/lock-insertsequences.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-
-scriptlog=$scriptlogpath/insertsequences-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
@@ -61,25 +53,32 @@
 echo "" >> $scriptlog 2>&1 
 
+cd $mars
+
 # process sequencefiles: insert information into the database
 for sequencefile in ${sequencefiles[@]}
 do 
+   printprocesslog "INFO inserting sequence from file $sequencefile"
    echo "file: "$sequencefile >> $scriptlog 2>&1 
    no=`echo $sequencefile | cut -c 31-38`
-   no=`echo $no | cut -c 1-4`
-   insertsequencepath=$logpath/insertsequence/$no
+   no2=`echo $no | cut -c 1-4`
+   insertsequencepath=$logpath/$program/$no2
    makedir $insertsequencepath >> $scriptlog 2>&1
-   insertsequencelog=$insertsequencepath/insertsequence-$no.log
+   insertsequencelog=$insertsequencepath/$program-$no.log
 
    check0=`root -q -b $macrospath/insertsequence.C+\("\"$sequencefile\""\,kFALSE\) | tee $insertsequencelog | grep int | sed -e 's/(int)//'`
    case $check0 in 
-      1)   echo "check0=$check0 -> everything ok " >> $scriptlog 2>&1 ;;
-      *)   echo "check0=$check0 -> ERROR " >> $scriptlog 2>&1 ;;
+      1)   echo "check0=$check0 -> everything ok " >> $scriptlog 2>&1 
+           printprocesslog "INFO sequence $no2 successfully inserted"
+           ;;
+      0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "WARN connection to DB failed"
+           check="no"
+           ;;
+      *)   echo "check0=$check0 -> ERROR " >> $scriptlog 2>&1 
+           printprocesslog "ERROR $program.C failed for sequence $no2"
+           ;;
    esac
 done
 
-rm -v $lockpath/lock-insertsequences.txt >> $scriptlog 2>&1 
+finish >> $scriptlog 2>&1
 
-set +C
-
-date  >> $scriptlog 2>&1
-
