A switch to disable checking if the service pid is in the correct cgroup

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2018-01-09 16:53:02 +03:00
parent 5c33fc5712
commit e2ac26902c
2 changed files with 16 additions and 5 deletions

15
ssm
View File

@ -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

View File

@ -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