diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2008-11-12 15:44:50 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2008-11-12 15:44:50 +0100 |
commit | a7770bc688e5dca68ffaeeb9d13b3a7ba04c2730 (patch) | |
tree | 9f9d69e656b172ec05278bdf587f992caf26895e /src | |
parent | 7bdce4242daa6eebe8d8a6d2f5856e11dfcc528e (diff) |
added function to check exit code phase/worker + doc execute function
Diffstat (limited to 'src')
-rwxr-xr-x | src/fifa.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/fifa.sh b/src/fifa.sh index 0a9c445..3c1de6c 100755 --- a/src/fifa.sh +++ b/src/fifa.sh @@ -106,6 +106,9 @@ load_lib () } +# $1 phase/worker +# $2 phase/worker name +# $3... extra args for phase/worker (optional) execute () { [ -z "$1" -o -z "$2" ] && die_error "Use the execute function like this: execute <type> <name> with type=phase/worker" @@ -157,6 +160,23 @@ execute () } +# check if a phase/worker executed sucessfully +# returns 0 if ok, the phase/workers' exit state otherwise (and returns 1 if not executed yet) +# $1 phase/worker +# $2 phase/worker name +ended_ok () +{ + [ -z "$1" -o -z "$2" ] && die_error "Use the ended_ok function like this: ended_ok <type> <name> with type=phase/worker" + [ "$1" != phase -a "$1" != worker ] && die_error "ended_ok's first argument must be a valid type (phase/worker)" + object=$1_$2 + exit_var=exit_$object + debug "Exit state of $objecct was: ${!exit_var} (if empty. it's not executed yet)" + [ "${!exit_var}" = '0' ] && return 0 + [ "${!exit_var}" = '' ] && return 1 + return ${!exit_var} +} + + depend_module () { load_module "$1" |