forked from evolix/evocheck
Log program exit
This commit is contained in:
parent
97a98c8df3
commit
ff92e3889e
|
@ -1503,9 +1503,12 @@ main() {
|
||||||
|
|
||||||
exit ${RC}
|
exit ${RC}
|
||||||
}
|
}
|
||||||
cleanup_temp_files() {
|
cleanup() {
|
||||||
|
# Cleanup tmp files
|
||||||
# shellcheck disable=SC2086,SC2317
|
# shellcheck disable=SC2086,SC2317
|
||||||
rm -f ${files_to_cleanup[@]}
|
rm -f ${files_to_cleanup[@]}
|
||||||
|
|
||||||
|
log "$PROGNAME exit."
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGNAME=$(basename "$0")
|
PROGNAME=$(basename "$0")
|
||||||
|
@ -1530,10 +1533,6 @@ readonly DATEFORMAT
|
||||||
export LANG=C
|
export LANG=C
|
||||||
export LANGUAGE=C
|
export LANGUAGE=C
|
||||||
|
|
||||||
declare -a files_to_cleanup
|
|
||||||
# shellcheck disable=SC2064
|
|
||||||
trap cleanup_temp_files 0
|
|
||||||
|
|
||||||
# Source configuration file
|
# Source configuration file
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
test -f "${CONFIGFILE}" && . "${CONFIGFILE}"
|
test -f "${CONFIGFILE}" && . "${CONFIGFILE}"
|
||||||
|
@ -1584,6 +1583,14 @@ while :; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Keep this after "show_version(); exit 0" which is called by check_versions
|
||||||
|
# to avoid logging exit twice.
|
||||||
|
declare -a files_to_cleanup
|
||||||
|
files_to_cleanup=""
|
||||||
|
# shellcheck disable=SC2064
|
||||||
|
trap cleanup EXIT INT TERM
|
||||||
|
|
||||||
|
log '-----------------------------------------------'
|
||||||
log "Running $PROGNAME $VERSION..."
|
log "Running $PROGNAME $VERSION..."
|
||||||
|
|
||||||
# Log config file content
|
# Log config file content
|
||||||
|
|
Loading…
Reference in a new issue