Ignore:
Timestamp:
08/24/06 12:15:46 (19 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/scripts/sourcefile

    r7925 r7927  
    7070Ffillganymed=21
    7171
     72#
    7273# setup for jobmanager
     74#
    7375steps=$mars/steps.rc
    74 
     76# resetting values
    7577pno=0
    7678totalpno=0
     
    7981runningscript=0
    8082queuedscript=0
    81 
     83stillinqueue=0
    8284
    8385function setzero()
     
    100102
    101103
    102 
    103104# in the following the function, which are needed by several scripts, are
    104105# defined
     
    113114}
    114115
    115 # function to do continue in a loop or exit the program depending on what is needed
    116 function contex()
    117 {
     116# function to do continue in a loop and produce according logging
     117function cont()
     118{
     119   date
    118120   echo ""
    119    if [ "$singleprocess" = "yes" ]
    120    then
    121       continue
    122    else
    123       finish
    124    fi
     121   continue
    125122}
    126123
     
    148145       1)   echo " checklock0=$checklock0 -> file $lockfile exists -> exit"
    149146            date
    150             contex;;
     147            exit;;
    151148       *)   echo " checklock0=$checklock0 -> something went completely wrong" ;;
    152149   esac
     
    154151
    155152# function calling the macro, which is producing the todo-list
    156 function getdolist()
     153function getdolistroot()
    157154{
    158155   datetime=`date +%F-%H-%M-%S`
     
    278275
    279276# function to get todolist
    280 function gettodo()
    281 {
    282    echo "getting todo..."
     277function getdolist()
     278{
     279   echo "getting todolist..."
    283280   getdbsetup
    284    if [ "$singleprocess" = "yes" ]
    285    then
    286       column=${scriptscolname[$i]}
    287    fi
    288281   getstepinfo
    289282   # get query
     
    296289      done
    297290   fi
    298    if ! echo $influences | grep '#' > /dev/null
    299    then
    300       for influence in $influences
    301       do
    302          query=$query" isnull($influence) and"
    303       done
    304    fi
    305291   query=$query" isnull($column) "
    306292   query=$query" and isnull(fStartTime) and isnull(fFailedTime) and isnull(fFailedCode) and isnull(fFailedCodeAdd) and isnull(fReturnCode) "
    307293   query=$query" order by $primary desc "
    308    if [ "$singleprocess" = "yes" ]
    309    then
    310       query=$query" limit 0, 1 "
    311    fi
    312294#   echo " QUERY: "$query
    313295   if ! process=`mysql -s -u $us --password=$pw --host=hercules $db -e " $query "`
    314296   then
    315       echo "ERROR could not query process from db -> contex"
    316       rm -v $lockfile
    317       contex
     297      echo "ERROR could not query process from db -> exit"
     298      finish
    318299   fi
    319300
     
    321302   then
    322303      echo "  => nothing to do"
    323       rm -v $lockfile
    324       contex
     304      finish
    325305   else
    326       if [ "$singleprocess" = "yes" ]
    327       then
    328          todofile=$listpath/ToDo-$table-$column-$process.txt
    329          echo "  => found $process"
    330       else
    331          todofile=$listpath/ToDo-$table-$column.txt
    332          echo "found processes"
    333       fi
    334 #      echo " list: "$todofile
     306      todofile=$listpath/ToDo-$table-$column.txt
    335307     
    336308      if ls $todofile > /dev/null 2>&1
    337309      then
    338310         echo "$todofile exists already"
    339          rm -v $lockfile
    340          contex
     311         finish
    341312      fi
     313      echo "found processes, writing todofile..."
    342314      echo $process > $todofile
     315   fi
     316}
     317
     318# function to get todo (process)
     319function gettodo()
     320{
     321   process=
     322   echo "getting todo..."
     323   getdbsetup
     324   getstepinfo
     325   # get query
     326   query=" select $primary from $table where "
     327   if ! echo $needs | grep '#' > /dev/null
     328   then
     329      for need in $needs
     330      do
     331         query=$query" not isnull($need) and"
     332      done
     333   fi
     334   query=$query" isnull($column) "
     335   query=$query" and isnull(fStartTime) and isnull(fFailedTime) and isnull(fFailedCode) and isnull(fFailedCodeAdd) and isnull(fReturnCode) "
     336   query=$query" order by $primary desc "
     337   query=$query" limit 0, 1 "
     338#   echo " QUERY: "$query
     339   if ! process=`mysql -s -u $us --password=$pw --host=hercules $db -e " $query "`
     340   then
     341      echo "ERROR could not query process from db -> exit"
     342      finish
     343   fi
     344
     345   if [ "$process" = "" ]
     346   then
     347      echo "  => nothing to do -> exit"
     348      finish
     349   fi
     350}
     351
     352# function to get the number of processes which still have to be done
     353function getstatus()
     354{
     355   numproc=
     356   echo "getting status..."
     357   getdbsetup
     358   column=${scriptscolname[$i]}
     359   getstepinfo
     360   # get query
     361   query=" select count(*) from $table where "
     362   if ! echo $needs | grep '#' > /dev/null
     363   then
     364      for need in $needs
     365      do
     366         query=$query" not isnull($need) and"
     367      done
     368   fi
     369   query=$query" isnull($column) "
     370   query=$query" and isnull(fStartTime) and isnull(fFailedTime) and isnull(fFailedCode) and isnull(fFailedCodeAdd) and isnull(fReturnCode) "
     371   query=$query" group by $column "
     372#   echo " QUERY: "$query
     373   if ! numproc=`mysql -s -u $us --password=$pw --host=hercules $db -e " $query "`
     374   then
     375      echo "ERROR could not query number of todo proceses from db -> continue"
     376      cont
    343377   fi
    344378}
     
    349383   resetstatusvalues
    350384   evalstatus $@
    351 
    352    echo "setting todo..."
    353385   getdbsetup
    354386   getstepinfo
    355387   # get query
    356388   reset=`grep "$coltab[.]Reset:" $steps | sed -e "s/$coltab[.]Reset://" -e 's/ //g'`
    357    echo -$reset-
    358389   if [ "$reset" = "no" ]
    359390   then
Note: See TracChangeset for help on using the changeset viewer.