diff --git a/ssm b/ssm index d3ebd7a..91ba31c 100755 --- a/ssm +++ b/ssm @@ -497,9 +497,12 @@ var service_reload_signal = 1 var service_stop_signal = 15 var service_cgroup_exclusive = 0 # Refuse to start the service if its cgroup is not empty var service_cgroup_wait = 0 # Wait on all the members of the cgroup to exit when stopping the service. + +# Global config var systemd = 0 # Enable systemd-related functions. var systemd_service_path = /etc/systemd/system /run/systemd/system /lib/systemd/system var cgroups = 0 # Enable cgroup-related functions +var cgroups_check_pid = 1 # Enable checking if the main service PID is in the correct cgroup before doing anythin with the service var usrdir = '/usr/share/ssm' # These are not @@ -581,9 +584,9 @@ else systemd && { for i in "${systemd_service_path[@]/%//$1.service}"; do [[ -f "$i" ]] && { - var service_name = "$1" - var service_systemd = 1 - var service_config = "$i" + service_name = "$1" + service_systemd = 1 + service_config = "$i" read_systemd_service "$i" break @@ -680,8 +683,10 @@ if cgroups; then fi # If there's a service PID, check if it's in the service's cgroup - if service_pid; then - service_cgroup_procs u "$service_pid" || die 29 "Recorded service PID is not in the service's cgroup, bailing!" + if cgroups_check_pid; then + if service_pid; then + service_cgroup_procs u "$service_pid" || die 29 "Recorded service PID is not in the service's cgroup, bailing!" + fi fi fi diff --git a/ssm.conf b/ssm.conf index d75fc64..718ad93 100644 --- a/ssm.conf +++ b/ssm.conf @@ -34,8 +34,14 @@ # Enable cgroup-related functions #cgroups = 0 +# Check if the recorded PID of the service is in the correct cgroup. +# Only works with cgroups = 1 +#cgroups_check_pid = 1 + # Refuse to start the service if its cgroup is not empty +# Only works with cgroups = 1 #service_cgroup_exclusive = 0 # Wait on all the members of the cgroup to exit when stopping the service. +# Only works with cgroups = 1 #service_cgroup_wait = 0