Index: trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7909)
+++ trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7910)
@@ -113,4 +113,16 @@
 }
 
+# function to do continue in a loop or exit the program depending on what is needed
+function contex()
+{
+   echo ""
+   if [ "$singleprocess" = "yes" ]
+   then 
+      continue
+   else
+      exit
+   fi
+}
+
 # function to make sure that a directory is made
 function makedir()
@@ -133,10 +145,9 @@
    checklock0=$?
    case $checklock0 in 
-       0)   echo "checklock0=$checklock0 -> continue " ;;
-       1)   echo "checklock0=$checklock0 -> file $lockfile exists "
-            echo "-> $@ $program is running -> exit"
+       0)   echo " checklock0=$checklock0 -> continue " ;;
+       1)   echo " checklock0=$checklock0 -> file $lockfile exists -> exit"
             date 
-            exit;;
-       *)   echo "checklock0=$checklock0 -> something went completely wrong" ;;
+            contex;;
+       *)   echo " checklock0=$checklock0 -> something went completely wrong" ;;
    esac
 }
@@ -158,6 +169,6 @@
 
    case $check0 in
-      1)   echo "check0=$check0 -> everything ok, got todo list -> run $program";;
-      *)   echo "check0=$check0 -> ERROR -> could not get todo list -> exit"
+      1)   echo " check0=$check0 -> everything ok, got todo list -> run $program";;
+      *)   echo " check0=$check0 -> ERROR -> could not get todo list -> exit"
            finish ;;
    esac
@@ -194,8 +205,8 @@
    resetstatusvalues
    case $@ in 
-      start)   echo "start"
+      start)   echo "setstatus start"
                starttime="Now()"
                ;;
-       stop)   echo "stop"
+       stop)   echo "setstatus stop"
                case $check in
                  ok)  echo " ok"
@@ -230,6 +241,6 @@
    checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$var2\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$returncode\""\,"\"$failedcode\""\,"\"$failedcodeadd\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
    case $checkstatus in
-      1)   echo "checkstatus=$checkstatus -> everything ok, status has been set";;
-      *)   echo "checkstatus=$checkstatus -> ERROR -> step could not be set -> exit"
+      1)   echo " checkstatus=$checkstatus -> everything ok, status has been set";;
+      *)   echo " checkstatus=$checkstatus -> ERROR -> step could not be set -> exit"
            finish ;;
    esac
@@ -262,15 +273,4 @@
 #   echo " influences: $influences"
 #   echo " primary: $primary"
-}
-
-function contex()
-{
-   echo ""
-   if [ "$singleprocess" = "yes" ]
-   then 
-      continue
-   else
-      exit
-   fi
 }
 
