Ignore:
Timestamp:
12/01/08 10:48:20 (16 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r9165 r9183  
    3131#
    3232
     33# check if script has been started with absolute path
     34if ! dirname $0 | grep -E '^/' >/dev/null 2>&1
     35then
     36   echo "Please start your script with an absolute path."
     37   exit
     38fi
     39
    3340source `dirname $0`/setup
    3441
     
    6774
    6875makedir $lockpath
     76
     77
     78# function to provide proper logging in a single logfile ($processlog)
     79function printprocesslog
     80{
     81   makedir $processlogpath
     82   echo `date +%F\ %T`" "`whoami`"@"$HOSTNAME" "`basename $0`"["$$"] "$@ >> $processlog
     83}
     84
     85# function to exit a script properly
     86function finish()
     87{
     88   if ! [ "$lockfile" = "" ] && ls $lockfile >/dev/null 2>&1
     89   then
     90      rm -v $lockfile
     91   fi
     92   date
     93   printprocesslog "INFO finished $0"
     94   exit
     95}
     96
    6997
    7098# set checkvalue to ok at the beginning of the scripts
     
    112140jmscriptlog=$runlogpath/jobmanager`date +%F`.log
    113141steps=$mars/resources/steps.rc
     142if ! ls $steps >/dev/null
     143then
     144   echo "Can't find steps.rc ($steps)"
     145   finish
     146fi
    114147sqlrc=$mars/sql.rc
     148if ! ls $sqlrc >/dev/null
     149then
     150   echo "Can't find sql.rc ($sqlrc)"
     151   finish
     152fi
    115153# resetting values
    116154pno=0
     
    129167# in the following the functions, which are needed by several scripts, are
    130168# defined
    131 
    132 function printprocesslog
    133 {
    134    makedir $processlogpath
    135    echo `date +%F\ %T`" "`whoami`"@"$HOSTNAME" "`basename $0`"["$$"] "$@ >> $processlog
    136 }
    137 
    138 # function to exit a script properly
    139 function finish()
    140 {
    141    if ! [ "$lockfile" = "" ] && ls $lockfile >/dev/null 2>&1
    142    then
    143       rm -v $lockfile
    144    fi
    145    date
    146    printprocesslog "INFO finished $0"
    147    exit
    148 }
    149169
    150170# function to do continue in a loop and produce according logging
Note: See TracChangeset for help on using the changeset viewer.