Reload resources on SIGHUP
This commit is contained in:
parent
8e294b4880
commit
104b83964b
30
rowbot
30
rowbot
|
@ -106,6 +106,8 @@ while (( $# )); do
|
|||
shift
|
||||
done
|
||||
|
||||
prog_args=( "$@" )
|
||||
|
||||
###
|
||||
# default config
|
||||
##
|
||||
|
@ -125,7 +127,7 @@ for file do
|
|||
# shellcheck disable=SC1090
|
||||
. "$file" # ha, dot file
|
||||
else
|
||||
die 'could not locate config file %s' "$file"
|
||||
die "could not locate config file %s" "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -203,7 +205,7 @@ if [[ $reload = yes ]]; then
|
|||
fi
|
||||
|
||||
###
|
||||
# process management
|
||||
# process/resource management
|
||||
###
|
||||
|
||||
cleanup() {
|
||||
|
@ -244,6 +246,30 @@ alarm-handler() {
|
|||
|
||||
trap alarm-handler ALRM
|
||||
|
||||
config-reload() {
|
||||
local file
|
||||
info "received HUP signal"
|
||||
|
||||
for file in "${prog_args[@]}"; do
|
||||
if [[ -f $file ]]; then
|
||||
debug "loading config file %s" "$file"
|
||||
# These files are provided dynamically at run-time.
|
||||
# shellcheck disable=SC1090
|
||||
. "$file"
|
||||
else
|
||||
die "could not locate config file %s" "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
if (( log_fd != 1 )); then
|
||||
debug "closing and re-opening log"
|
||||
exec {log_fd}>&-
|
||||
exec {log_fd}>"$log"
|
||||
fi
|
||||
}
|
||||
|
||||
trap config-reload HUP
|
||||
|
||||
###
|
||||
# net code
|
||||
###
|
||||
|
|
Loading…
Reference in New Issue