Module: check_mk
Branch: master
Commit: fedccd95e72acd01e12f00df58855907a77d87d0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fedccd95e72acd…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 26 07:20:13 2018 +0100
5865 FIX omd rm --kill now kills all processes of the site user
Instead of just killing the processes that are currently accessing
the tmpfs of the site, the "omd rm" command together with the --kill
option now also kills all processes of the site user. This includes
open shells or similar that would otherwise make the site removal
fail in case such processes are open.
Change-Id: I88ec7cfdbf00f5f4950405d58138638c20480e64
---
.werks/5865 | 14 ++++++++++++++
omd/packages/omd/omd | 7 +++++--
omd/packages/omd/omd.8 | 4 ++--
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/.werks/5865 b/.werks/5865
new file mode 100644
index 0000000..1d9959f
--- /dev/null
+++ b/.werks/5865
@@ -0,0 +1,14 @@
+Title: omd rm --kill now kills all processes of the site user
+Level: 1
+Component: omd
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1519626013
+Class: fix
+
+Instead of just killing the processes that are currently accessing
+the tmpfs of the site, the "omd rm" command together with the --kill
+option now also kills all processes of the site user. This includes
+open shells or similar that would otherwise make the site removal
+fail in case such processes are open.
diff --git a/omd/packages/omd/omd b/omd/packages/omd/omd
index 05b81b8..8d9c7d3 100644
--- a/omd/packages/omd/omd
+++ b/omd/packages/omd/omd
@@ -2816,8 +2816,11 @@ def main_rm(args, options={}):
reuse = "reuse" in options
kill = "kill" in options
- if not kill and user_logged_in(g_sitename):
- bail_out("User '%s' still logged in or running processes." %
g_sitename)
+ if user_logged_in(g_sitename):
+ if not kill:
+ bail_out("User '%s' still logged in or running processes."
% g_sitename)
+ else:
+ kill_site_user_processes(exclude_current_and_parents=True)
if tmpfs_mounted(g_sitename):
unmount_tmpfs(g_sitename, kill=kill)
diff --git a/omd/packages/omd/omd.8 b/omd/packages/omd/omd.8
index 30c5272..c5e4d30 100644
--- a/omd/packages/omd/omd.8
+++ b/omd/packages/omd/omd.8
@@ -150,8 +150,8 @@ and group of that site. This - of course - needs root permissions.
The following options can be used:
The option \fB--kill\fP will automatically kill all processes that
-use the temporary filesystem of the site before unmounting it.
-Otherwise the unmount and the removal of the site will fail.
+either use the temporary filesystem of the site or are running as site
+user. Otherwise the unmount and the removal of the site will fail.
\fB--apache-reload\fP Issue a reaload of the apache process instead of the default
restart