Changeset 9456 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
06/12/09 14:15:47 (15 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r9400 r9456  
    5656      then
    5757         echo "could not make dir "$@
     58         if ! [ "$processlog" = "" ]
     59         then
     60            echo `date +%F\ %T`" "`whoami`"@"$HOSTNAME" "`basename $0`"["$$"] could not make dir "$@ >> $processlog
     61         fi
    5862         if ls $lockfile >/dev/null 2>&1
    5963         then
     
    133137Fmcstar=31
    134138Ffillmcstar=32
     139Fcorsikasimtel=33
     140Fchimp=34
     141Fchimpcp=35
     142Fctastar=36
     143Fctastarcp=37
     144FctastereoA=38
     145FctastereoB=39
     146FctastereoC=40
     147FctastereoD=41
     148FctastereoE=42
     149FctastereoF=43
     150FctastereoG=44
     151FctastereoH=45
     152Fctastereocp=46
    135153
    136154# setup for jobmanager:
     
    165183alias 'intgrep'='grep -E -o \\\(int\\\)[0-9]+$ | grep -E -o [0-9]+'
    166184
     185
    167186# in the following the functions, which are needed by several scripts, are
    168187# defined
     
    177196
    178197# function to check if a process is already locked
     198#  command line option can be used to execute something, e.g. 'continue'
    179199function checklock()
    180200{
    181    date > $lockfile
    182    checklock0=$?
    183    case $checklock0 in
    184       0)   printprocesslog "INFO checklock0=$checklock0 -> continue "
    185            ;;
    186       1)   printprocesslog "WARN checklock0=$checklock0 -> file $lockfile exists"
    187            $@
    188            exit;;
    189       *)   printprocesslog "ERROR checklock0=$checklock0 -> something went completely wrong" ;;
    190    esac
     201   if ! echo `date +%F\ %T`" "`whoami`"@"$HOSTNAME" "`basename $0`"["$$"] "`uname -a` > $lockfile 2>/dev/null
     202   then
     203      printprocesslog "WARN lockfile $lockfile exists"
     204      $@
     205      exit
     206   else
     207      printprocesslog "INFO created lockfile $lockfile"
     208   fi
    191209}
    192210
     
    280298   getstepinfo
    281299   # get query
    282    query=" select "${prims[0]}
     300   query=" SELECT "${prims[0]}
    283301   for (( i=1 ; i < ${#prims[@]} ; i++ ))
    284302   do
    285303      query=$query", ${prims[$i]}"
    286304   done
    287    query=$query" from $table where "
     305   query=$query" FROM $table WHERE "
    288306   if ! echo $needs | grep '#' > /dev/null
    289307   then
    290308      for need in $needs
    291309      do
    292          query=$query" not isnull($need) and"
     310         query=$query" NOT ISNULL($need) AND"
    293311      done
    294312   fi
    295    query=$query" isnull($column) "
    296    query=$query" and isnull(fStartTime) and isnull(fFailedTime) and isnull(fProgramId) and isnull(fReturnCode) "
    297    query=$query" order by fPriority desc "
    298    if [ "$@ " != " " ]
     313   query=$query" ISNULL($column) "
     314   if [ "$2 " != " " ]
    299315   then
    300       query=$query" limit 0, $@ "
    301    fi
    302    printprocesslog "INFO QUERY: "$query
     316      query=$query" AND fProductionHostKEY=$2 "
     317   fi
     318   query=$query" AND ISNULL(fStartTime) AND ISNULL(fFailedTime) AND ISNULL(fProgramId) AND ISNULL(fReturnCode) "
     319   query=$query" ORDER BY fPriority desc "
     320   if [ "$1 " != " " ]
     321   then
     322      query=$query" limit 0, $1 "
     323   fi
     324#   echo " QUERY: "$query
     325   printprocesslog "INFO gettodo QUERY: "$query
    303326   if ! process=`mysql -s -u $us --password=$pw --host=$ho $db -e " $query "`
    304327   then
     
    325348   getstepinfo
    326349   # get query
    327    query=" select count(*) from $table where "
     350   query=" SELECT COUNT(*) FROM $table WHERE "
    328351   if ! echo $needs | grep '#' > /dev/null
    329352   then
    330353      for need in $needs
    331354      do
    332          query=$query" not isnull($need) and"
     355         query=$query" NOT ISNULL($need) AND"
    333356      done
    334357   fi
    335    query=$query" isnull($column) "
    336    query=$query" and isnull(fStartTime) and isnull(fFailedTime) and isnull(fProgramId) and isnull(fReturnCode) "
    337    query=$query" group by $column "
    338 #   printprocesslog "INFO  QUERY: "$query
     358   query=$query" ISNULL($column) "
     359   if [ "$1 " != " " ]
     360   then
     361      query=$query" AND fProductionHostKEY=$1 "
     362   fi
     363   query=$query" AND ISNULL(fStartTime) AND ISNULL(fFailedTime) AND ISNULL(fProgramId) AND ISNULL(fReturnCode) "
     364   query=$query" GROUP BY $column "
     365#   echo "QUERY: "$query
     366   printprocesslog "INFO getstatus QUERY: "$query
    339367   if ! numproc=`mysql -s -u $us --password=$pw --host=$ho $db -e " $query "`
    340368   then
     
    383411   for (( i=1 ; i < ${#prims[@]} ; i++ ))
    384412   do
    385       query=$query" and ${prims[$i]}='${primaries[$s*${#prims[@]}+$i]}' "
     413      query=$query" AND ${prims[$i]}='${primaries[$s*${#prims[@]}+$i]}' "
    386414   done   
    387    printprocesslog "INFO QUERY: "$query
     415#   echo " QUERY: "$query
     416   printprocesslog "INFO setstatus QUERY: "$query
    388417   if ! mysql -s -u $us --password=$pw --host=$ho $db -e " $query "
    389418   then
     
    398427{
    399428   getdbsetup
     429   printprocesslog "INFO sendquery QUERY: "$query
    400430   if ! val=`mysql -s -u $us --password=$pw --host=$ho $db -e " $query "`
    401431   then
Note: See TracChangeset for help on using the changeset viewer.