Changeset 8482 for trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
- Timestamp:
- 05/09/07 17:05:15 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
r8400 r8482 20 20 # Author(s): Daniela Dorner 05/2005 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 47 47 if [ ! -d $@ ] 48 48 then 49 mkdir -pv $@50 if [ ! -d $@ ]51 then52 echo "could not make dir "$@53 rm -v $todofile54 rm -v $lockfile55 date56 exit57 fi49 mkdir -pv $@ 50 if [ ! -d $@ ] 51 then 52 echo "could not make dir "$@ 53 rm -v $todofile 54 rm -v $lockfile 55 date 56 exit 57 fi 58 58 fi 59 59 } … … 133 133 function finish() 134 134 { 135 if ls $todofile >/dev/null 2>&1135 if ! [ "$todofile" = "" ] && ls $todofile >/dev/null 2>&1 136 136 then 137 137 rm -v $todofile … … 160 160 checklock0=$? 161 161 case $checklock0 in 162 0) echo " checklock0=$checklock0 -> continue " ;; 163 1) echo " checklock0=$checklock0 -> file $lockfile exists -> exit" 164 date 165 exit;; 166 *) echo " checklock0=$checklock0 -> something went completely wrong" ;; 162 0) echo " checklock0=$checklock0 -> continue " ;; 163 1) echo " checklock0=$checklock0 -> file $lockfile exists" 164 date 165 $@ 166 exit;; 167 *) echo " checklock0=$checklock0 -> something went completely wrong" ;; 167 168 esac 168 }169 170 # function calling the macro, which is producing the todo-list171 function getdolistroot()172 {173 datetime=`date +%F-%H-%M-%S`174 year=`date +%Y`175 date=NULL176 177 getstatuslogpath=$logpath/getstatus/$program/$year178 getstatuslog=$getstatuslogpath/getstatus-$table-$column-$datetime.log179 makedir $getstatuslogpath180 181 # get todo list182 echo "getting todo list..."183 check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`184 185 case $check0 in186 1) echo " check0=$check0 -> everything ok, got todo list -> run $program";;187 *) echo " check0=$check0 -> ERROR -> could not get todo list -> exit"188 finish ;;189 esac190 191 169 } 192 170 … … 222 200 ;; 223 201 stop) case $check in 224 ok) echo "setstatus stop - ok"225 statustime="Now()"226 ;;227 no) echo "setstatus stop - nothing new"228 check="ok"229 ;;230 *) echo "setstatus stop - failed"231 starttime=noreset232 if [ "$check" == "" ]233 then234 returncode=1235 else236 returncode=$check237 fi238 failedcode=$com239 if ! [ "$comadd" = "" ]240 then241 failedcodeadd=$comadd242 fi243 failedtime="Now()"244 check="ok"245 ;;202 ok) echo "setstatus stop - ok" 203 statustime="Now()" 204 ;; 205 no) echo "setstatus stop - nothing new" 206 check="ok" 207 ;; 208 *) echo "setstatus stop - failed" 209 starttime=noreset 210 if [ "$check" == "" ] 211 then 212 returncode=1 213 else 214 returncode=$check 215 fi 216 failedcode=$com 217 if ! [ "$comadd" = "" ] 218 then 219 failedcodeadd=$comadd 220 fi 221 failedtime="Now()" 222 check="ok" 223 ;; 246 224 esac 247 225 ;; … … 250 228 finish 251 229 ;; 252 esac253 }254 255 # function calling the macro to set the status, after a process has finished256 function setstatusroot()257 {258 # set status values259 resetstatusvalues260 evalstatus $@261 262 # printstatusvalues263 # set status264 setstatuslogpath=$logpath/setstatus/$program/$var1265 makedir $setstatuslogpath266 setstatuslog=$setstatuslogpath/setstatus-$@-$program-$var2.log267 checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$var2\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$returncode\""\,"\"$failedcode\""\,"\"$failedcodeadd\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`268 case $checkstatus in269 1) echo " checkstatus=$checkstatus -> everything ok, status has been set";;270 *) echo " checkstatus=$checkstatus -> ERROR -> step could not be set -> exit"271 finish ;;272 230 esac 273 231 } … … 417 375 if [ "$reset" = "no" ] 418 376 then 419 echo "YOU CAN'T RESET $column for $ var2!!!"420 printprocesslog "ERROR you can't reset $column for $ var2"377 echo "YOU CAN'T RESET $column for $primvar!!!" 378 printprocesslog "ERROR you can't reset $column for $primvar" 421 379 finish 422 380 fi … … 434 392 fi 435 393 query=$query", fFailedTime=$failedtime, fFailedCode=$failedcode, fFailedCodeAdd=$failedcodeadd, fReturnCode=$returncode " 436 query=$query" where $primary='$ var2'"394 query=$query" where $primary='$primvar'" 437 395 echo " QUERY: "$query 438 396 if ! mysql -s -u $us --password=$pw --host=vela $db -e " $query " … … 445 403 } 446 404 405 # function to send a mysql query 406 function sendquery() 407 { 408 getdbsetup 409 if ! val=`mysql -s -u $us --password=$pw --host=vela $db -e " $query "` 410 then 411 printprocesslog "ERROR could not query db (program: $program, function sendquery)" 412 return 1 413 fi 414 if [ "$val" = "NULL" ] 415 then 416 val= 417 fi 418 echo $val 419 return 0 420 } 421
Note:
See TracChangeset
for help on using the changeset viewer.