From 02ab253887c5e2e4c1a46243677605804ff6a62d Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Fri, 20 Jul 2018 12:14:33 +0200 Subject: [PATCH] Add grace location summary to low space notification Fixes #41 --- ATxService/Email.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ATxService/Email.cs b/ATxService/Email.cs index d931664..d9ad445 100644 --- a/ATxService/Email.cs +++ b/ATxService/Email.cs @@ -116,6 +116,12 @@ namespace ATxService return; } + // reaching this point means a notification will be sent to the admin, and in that + // case it makes sense to also include details about the grace location: + var graceReport = FsUtils.GraceLocationSummary( + new DirectoryInfo(_config.DonePath), _config.GracePeriod); + + Log.Warn("WARNING: {0}", spaceDetails); _status.LastStorageNotification = DateTime.Now; @@ -127,6 +133,8 @@ namespace ATxService }; try { var body = LoadMailTemplate("DiskSpace-Low.txt", substitutions); + if (graceReport.Length > 0) + body += $"\n\n--\n{graceReport}"; SendEmail(_config.AdminEmailAdress, "low disk space", body); } catch (Exception ex) { -- GitLab