Module: check_mk
Branch: master
Commit: f131580f2cb9a8d5d9343261d739e887dde79227
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f131580f2cb9a8…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Apr 1 13:59:44 2016 +0200
3016 FIX mk-job: scheduled jobs are now always executed despite of any status file
permission problems
The mk-job call could fail if the status file for this command could not get created
due to permission problems.
With this fix insufficient permissions now only prevent the creation of the status file.
The command itself is executed nevertheless.
---
.werks/3016 | 11 +++++++++++
ChangeLog | 1 +
agents/mk-job | 11 ++++++++++-
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/.werks/3016 b/.werks/3016
new file mode 100644
index 0000000..3ab6323
--- /dev/null
+++ b/.werks/3016
@@ -0,0 +1,11 @@
+Title: mk-job: scheduled jobs are now always executed despite of any status file
permission problems
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1459511566
+Class: fix
+
+The mk-job call could fail if the status file for this command could not get created
+due to permission problems. With this fix insufficient permissions now only prevent the
creation of the status file.
+The command itself is executed nevertheless.
diff --git a/ChangeLog b/ChangeLog
index 1c9dd97..e8baf21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -117,6 +117,7 @@
* 3015 FIX: Dump host (cmk -D): fixed exception with service descriptions containing
umlauts
* 3110 FIX: ewon: Various improvements to snmp proxy functionality...
NOTE: Please refer to the migration notes!
+ * 3016 FIX: mk-job: scheduled jobs are now always executed despite of any status file
permission problems...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/mk-job b/agents/mk-job
index 46bc862..342df2b 100755
--- a/agents/mk-job
+++ b/agents/mk-job
@@ -62,7 +62,16 @@ if ! type $1 >/dev/null 2>&1; then
exit 1
fi
-date +"start_time %s" > "$OUTPUT_PATH/$IDENT.running"
+date +"start_time %s" > "$OUTPUT_PATH/$IDENT.running"
2>/dev/null
+
+if [ ! -w "$OUTPUT_PATH/$IDENT.running" ] ; then
+ # Looks like we are lacking the permissions to create this file..
+ # In this scenario no mk-job status file is created. We simply execute the command
+ $@
+ exit $?
+fi
+
+
/usr/bin/time -o "$OUTPUT_PATH/$IDENT.running" --append \
-f "exit_code %x\nreal_time %E\nuser_time %U\nsystem_time %S\nreads
%I\nwrites %O\nmax_res_kbytes %M\navg_mem_kbytes %K\ninvol_context_switches
%c\nvol_context_switches %w" "$@"
RC=$?