cronie/Add-CMDEND-log-entry-to-log-when-cron-jobs-end.patch
2020-07-23 18:31:35 +08:00

32 lines
848 B
Diff

From 05f5f1834d31e4d9480b59d4e8bd3e999a62fa40 Mon Sep 17 00:00:00 2001
From: John Horne <john.horne@plymouth.ac.uk>
Date: Mon, 20 Apr 2020 16:02:31 +0100
Subject: [PATCH] Add CMDEND log entry to log when cron jobs end.
---
src/do_command.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/do_command.c b/src/do_command.c
index ed56775..dda8ff7 100644
--- a/src/do_command.c
+++ b/src/do_command.c
@@ -581,6 +581,14 @@ static int child_process(entry * e, char **jobenv) {
Debug(DPROC,
("[%ld] no more grandchildren--mail written?\n",
(long) getpid()));
+
+ if ((e->flags & DONT_LOG) == 0) {
+ char *x = mkprints((u_char *) e->cmd, strlen(e->cmd));
+
+ log_it(usernm, getpid(), "CMDEND", x, 0);
+ free(x);
+ }
+
break;
}
Debug(DPROC, ("[%ld] grandchild #%ld finished, status=%04x",
--
1.8.3.1