Ignore:
Timestamp:
08/22/06 13:05:14 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r7907 r7908  
    236236}
    237237
    238 
    239 
     238function getdbsetup()
     239{
     240   db=`grep Database $mars/sql.rc | grep -v '#' | sed -e 's/Database: //' -e 's/ //g'`
     241   pw=`grep Password $mars/sql.rc | grep -v '#' | sed -e 's/Password: //' -e 's/ //g'`
     242   us=`grep User $mars/sql.rc | grep -v '#' | sed -e 's/User: //' -e 's/ //g'`
     243#   echo "setup: "
     244#   echo " db: "$db
     245#   echo " pw: "$pw
     246#   echo " us: "$us
     247}
     248
     249function getstepinfo()
     250{
     251   if [ "$singleprocess" = "yes" ]
     252   then
     253      column=${scriptscolname[$i]}
     254   fi
     255   table=`grep "$column:" $steps | sed -e "s/[.]$column://" -e 's/#//' -e 's/ //g'`
     256   coltab=`grep "$column:" $steps | sed -e 's/://' -e 's/#//' -e 's/ //g'`
     257   needs=`grep "$coltab[.]Needs:" $steps | sed -e "s/$coltab[.]Needs://"`
     258   influences=`grep "$coltab[.]Influences:" $steps | sed -e "s/$coltab[.]Influences://"`
     259   primary=`grep "$table[.]Primary:" $steps | sed -e "s/$table[.]Primary://"`
     260#   echo " column $column - table $table - coltab $coltab"
     261#   echo " needs: $needs"
     262#   echo " influences: $influences"
     263#   echo " primary: $primary"
     264}
     265
     266function contex()
     267{
     268   echo ""
     269   if [ "$singleprocess" = "yes" ]
     270   then
     271      continue
     272   else
     273      exit
     274   fi
     275}
     276
     277function gettodo()
     278{
     279   echo "getting todo..."
     280   getdbsetup
     281   getstepinfo
     282   # get query
     283   query=" select $primary from $table where "
     284   if ! echo $needs | grep '#' > /dev/null
     285   then
     286      for need in $needs
     287      do
     288         query=$query" not isnull($need) and"
     289      done
     290   fi
     291   if ! echo $influences | grep '#' > /dev/null
     292   then
     293      for influence in $influences
     294      do
     295         query=$query" isnull($influence) and"
     296      done
     297   fi
     298   query=$query" isnull(fStartTime) and isnull(fFailedTime) and isnull(fFailedCode) and isnull(fFailedCodeAdd) and isnull(fReturnCode) order by $primary desc "
     299   if [ "$singleprocess" = "yes" ]
     300   then
     301      query=$query" limit 0, 1 "
     302   fi
     303#   echo " QUERY: "$query
     304   process=`mysql -s -u $us --password=$pw --host=hercules $db -e " $query "`
     305
     306   if [ "$process" = "" ]
     307   then
     308      echo "  => nothing to do"
     309      contex
     310   else
     311      if [ "$singleprocess" = "yes" ]
     312      then
     313         listfile=$listpath/ToDo-$table-$column-$process.txt
     314         echo "  => found $process"
     315      else
     316         listfile=$listpath/ToDo-$table-$column.txt
     317         echo "found processes"
     318      fi
     319#      echo " list: "$listfile
     320     
     321      if ls $listfile > /dev/null 2>&1
     322      then
     323         echo "$listfile exists already"
     324         contex
     325      fi
     326      echo $process > $listfile
     327   fi
     328}
Note: See TracChangeset for help on using the changeset viewer.