default can do arrays now
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
b13b47d1c0
commit
253fd1f094
20
ssm
20
ssm
|
@ -4,11 +4,13 @@ shopt -s nullglob
|
|||
# Utility functions
|
||||
## Make setting default values a bit less awkward
|
||||
default() {
|
||||
declare -n _p=$1
|
||||
declare -n _p=$1; shift
|
||||
|
||||
if ! [[ "$_p" ]]; then
|
||||
_p=$2
|
||||
fi
|
||||
[[ "$_p" ]] || {
|
||||
for v in "$@"; do
|
||||
_p+=( "$v" )
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
## Die. Why not?
|
||||
|
@ -409,16 +411,14 @@ main() {
|
|||
# Service-level defaults
|
||||
default service_pidfile "$svc_pidfile"
|
||||
default service_logfile "$logdir/$service_name.log"
|
||||
default service_ready_flag "$rundir/$service_name.ready"
|
||||
default service_enabled_flag "$rundir/$service_name.enabled"
|
||||
default service_stopped_flag "$rundir/$service_name.stopped"
|
||||
default service_stop_timeout 30
|
||||
default service_ready_timeout 15
|
||||
default service_stop_signal 15
|
||||
default service_reload_signal 1
|
||||
default service_ready_flag "$rundir/$service_name.ready"
|
||||
default service_enabled_flag "$rundir/$service_name.enabled"
|
||||
default service_stopped_flag "$rundir/$service_name.stopped"
|
||||
|
||||
# default does not support arrays
|
||||
[[ "$service_signals" ]] || service_signals=( 1 10 12 )
|
||||
default service_signals 1 10 12
|
||||
|
||||
# Let's see if there's a PID
|
||||
if [[ -f "$service_pidfile" ]]; then
|
||||
|
|
Loading…
Reference in New Issue
Block a user