From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/openrc:master commit in: sh/, etc/
Date: Fri, 15 Sep 2017 18:31:41 +0000 (UTC) [thread overview]
Message-ID: <1505423840.6a5ca2ab368d0a85f51bb559672dba2e3ffcc6be.williamh@OpenRC> (raw)
commit: 6a5ca2ab368d0a85f51bb559672dba2e3ffcc6be
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Sep 14 16:40:26 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Sep 14 21:17:20 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=6a5ca2ab
make the procedure for killing child processes of services configurable
etc/rc.conf | 29 ++++++++++++++++++++++++++---
sh/rc-cgroup.sh.in | 13 ++++++++-----
2 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/etc/rc.conf b/etc/rc.conf
index d9ad911d..b7296d35 100644
--- a/etc/rc.conf
+++ b/etc/rc.conf
@@ -277,10 +277,33 @@ rc_tty_number=12
# Set this to YES if you want all of the processes in a service's cgroup
# killed when the service is stopped or restarted.
-# This should not be set globally because it kills all of the service's
-# child processes, and most of the time this is undesirable. Please set
-# it in /etc/conf.d/<service>.
+# Be aware that setting this to yes means all of a service's
+# child processes will be killed. Keep this in mind if you set this to
+# yes here instead of for the individual services in
+# /etc/conf.d/<service>.
# To perform this cleanup manually for a stopped service, you can
# execute cgroup_cleanup with /etc/init.d/<service> cgroup_cleanup or
# rc-service <service> cgroup_cleanup.
+# The process followed in this cleanup is the following:
+# 1. send stopsig (sigterm if it isn't set) to all processes left in the
+# cgroup immediately followed by sigcont.
+# 2. Send sighup to all processes in the cgroup if rc_send_sighup is
+# yes.
+# 3. delay for rc_timeout_stopsec seconds.
+# 4. send sigkill to all processes in the cgroup unless disabled by
+# setting rc_send_sigkill to no.
# rc_cgroup_cleanup="NO"
+
+# If this is yes, we will send sighup to the processes in the cgroup
+# immediately after stopsig and sigcont.
+#rc_send_sighup="NO"
+
+# This is the amount of time in seconds that we delay after sending sigcont
+# and optionally sighup, before we optionally send sigkill to all
+# processes in the # cgroup.
+# The default is 90 seconds.
+#rc_timeout_stopsec="90"
+
+# If this is set to no, we do not send sigkill to all processes in the
+# cgroup.
+#rc_send_sigkill="YES"
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 47a007b6..4b713594 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -204,10 +204,13 @@ cgroup_cleanup()
local pids
pids="$(cgroup_get_pids)"
if [ -n "${pids}" ]; then
- kill -s TERM "${pids}"
- sleep 1
- pids="$(cgroup_get_pids)"
- [ -n "${pids}" ] &&
- kill -s KILL "${pids}"
+ kill -s "${stopsig:-SIGTERM}" ${pids} 2> /dev/null
+ kill -s SIGCONT ${pids} 2> /dev/null
+ yesno "${rc_send_sighup:-no}" &&
+ kill -s SIGHUP ${pids} 2> /dev/null
+ sleep "${rc_timeout_stopsec:-90}"
+ yesno "${rc_send_sigkill:-yes}" &&
+ kill -s SIGKILL ${pids} 2> /dev/null
fi
+ eend 0
}
next reply other threads:[~2017-09-15 18:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-15 18:31 William Hubbs [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-12-17 22:57 [gentoo-commits] proj/openrc:master commit in: sh/, etc/ William Hubbs
2015-10-06 21:34 William Hubbs
2015-05-08 17:11 William Hubbs
2013-04-25 22:02 William Hubbs
2013-03-12 18:10 William Hubbs
2013-02-19 23:11 William Hubbs
2012-11-12 17:00 William Hubbs
2011-11-17 22:46 William Hubbs
2011-11-17 22:36 William Hubbs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1505423840.6a5ca2ab368d0a85f51bb559672dba2e3ffcc6be.williamh@OpenRC \
--to=williamh@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox