a flag for remembering service configs

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2018-04-08 16:54:23 +03:00
parent 0d95965b5b
commit e948f6985a

6
ssm
View File

@ -652,6 +652,7 @@ var service_cgroup_cleanup = 0 # Clean up the cgroup when the main PID exits. Us
var service_success_exit = 0 # Array, takes exit codes that are to be treated as successful termination.
var service_pidfile_timeout = 15 # How long to wait for unmanaged services to create their pidfiles.
var service_pidfile_remove_stale = 1 # Remove stale pidfiles from unmanaged services.
var service_remember = 1 # Copy the config into ssm's runtime dir.
# Global config
var cgroups = 0 # Enable cgroup-related functions
@ -836,10 +837,11 @@ flag_reset_exit && { reset-exit; die $?; }
source -- "$service_config" "${@:3}" || die 7 "Failed to read the service config: $service_config"
# “Load” the service into memory
service_config == "$service_config_current" || {
if ! service_config == "$service_config_current" && service_remember; then
cat "$service_config" > "$rundir/current/$service_name"
printf 'Loaded %s from: %s\n' "$service_name" "$service_config" >&2
}
service_config = "$rundir/current/$service_name"
fi
# Die if we only needed to load a service
flag_load_service && die 0