From be500d22790dbfc835ad077b883d0bf7d01b848b Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sat, 31 Oct 2026 16:01:06 -0700 Subject: [PATCH] case 4684 - server log records the next automatic backup at startup Co-Authored-By: Claude Opus 5.5 --- docs/8.0/ayanova/docs/changelog.md | 1 + server/AyaNova/Startup.cs | 3 +++ server/AyaNova/util/ServerGlobalOpsSettingsCache.cs | 12 ++++++++++++ 3 files changed, 16 insertions(+) diff --git a/docs/8.0/ayanova/docs/changelog.md b/docs/8.0/ayanova/docs/changelog.md index 49fc70ba..24a632b4 100644 --- a/docs/8.0/ayanova/docs/changelog.md +++ b/docs/8.0/ayanova/docs/changelog.md @@ -19,6 +19,7 @@ IN PROGRESS - Server: in some cases the automatic backup could be skipped for one day after the AyaNova server was restarted or a manual backup was made; it now always runs at the next chosen [backup time](ops-form-backup.md#backup-time). - Server: in some cases opening a record that has since been deleted (for example from an old link) gave a server error, and a report printed for records of which some had since been deleted failed; it now shows a "not found" message, and the report prints the remaining records. - Server: in some cases deleting a record that is still in use elsewhere (for example a customer, unit, part or rate used on a work order, quote or PM) gave a server error; it now always says which kind of record is using it. +- Server: the server log now records the next automatic backup time (or that automatic backup is off) each time the server starts. ### AyaNova 8.3.0 diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs index b7337c6a..dcfe4fe8 100644 --- a/server/AyaNova/Startup.cs +++ b/server/AyaNova/Startup.cs @@ -674,6 +674,9 @@ namespace AyaNova //Log the license info so it's on the record _newLog.LogInformation($"License - [{AyaNova.Core.License.LicenseInfoLogFormat}]"); + //case 4684: so the log of a restarted server shows whether, and when, the next backup will run + _newLog.LogInformation(ServerGlobalOpsSettingsCache.BackupStatusText()); + //Check for SuperUser password override if (!string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_SET_SUPERUSER_PW)) diff --git a/server/AyaNova/util/ServerGlobalOpsSettingsCache.cs b/server/AyaNova/util/ServerGlobalOpsSettingsCache.cs index 6820c50a..c63a9b75 100644 --- a/server/AyaNova/util/ServerGlobalOpsSettingsCache.cs +++ b/server/AyaNova/util/ServerGlobalOpsSettingsCache.cs @@ -89,5 +89,17 @@ namespace AyaNova.Util return TimeZoneInfo.ConvertTimeToUtc(local, TimeZoneInfo.Local); } + //case 4684: the backup schedule as written to the server log, on the server's clock as the backup time is set + internal static string BackupStatusText() + { + if (!Backup.Active) + return "Automatic backup - inactive"; + var utc = DateTime.SpecifyKind(NextBackup, DateTimeKind.Utc); + var local = TimeZoneInfo.ConvertTimeFromUtc(utc, TimeZoneInfo.Local); + //from the UTC moment, so the night the clocks go back shows the offset of the hour actually meant + var offset = TimeZoneInfo.Local.GetUtcOffset(utc); + return $"Automatic backup - next at {local:yyyy-MM-dd HH:mm} (UTC{(offset < TimeSpan.Zero ? "-" : "+")}{offset:hh\\:mm})"; + } + }//eoc }//eons \ No newline at end of file