From d9f2b1075bc6ae72a271fabbbe4fa7060ffc7579 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Fri, 25 Jun 2004 18:47:54 +0000
Subject: [PATCH] Append user name to reason as well as the timestamp.

---
 NEWS                    | 4 ++--
 src/scontrol/scontrol.c | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index f65317cd4d2..489ac5ec4a0 100644
--- a/NEWS
+++ b/NEWS
@@ -12,8 +12,8 @@ documents those changes that are of interest to users and admins.
  -- Fix bug in purging of batch jobs (active batch jobs were being 
     improperly purged starting in version 0.3.0).
  -- When updating a node state to DRAINING/DRAINED a Reason must be 
-    provided and a timestamp will automatically be appended to that 
-    Reason
+    provided. The user name and a timestamp will automatically be 
+    appended to that Reason.
 
 * Changes in SLURM 0.3.4
 ========================
diff --git a/src/scontrol/scontrol.c b/src/scontrol/scontrol.c
index 72a4187722b..f0335843386 100644
--- a/src/scontrol/scontrol.c
+++ b/src/scontrol/scontrol.c
@@ -1537,10 +1537,12 @@ _update_node (int argc, char *argv[])
 			if ((len >= 0) && (reason_str[len] == '"'))
 				reason_str[len] = '\0';
 
-			/* Append date and time */
+			/* Append user, date and time */
+			xstrcat(reason_str, " [");
+			xstrcat(reason_str, getlogin());
 			now = time(NULL);
 			time_ptr = localtime(&now);
-			strftime(time_buf, sizeof(time_buf), " %b %d %H:%M", 
+			strftime(time_buf, sizeof(time_buf), "@%b %d %H:%M]", 
 				time_ptr);
 			xstrcat(reason_str, time_buf);
 				
-- 
GitLab