From da73a87bcac07ca94a76d069e02aefbb80c9aa9a Mon Sep 17 00:00:00 2001
From: ansgarz <ansgar.zwick@meissa.de>
Date: Fri, 20 Dec 2024 13:28:39 +0100
Subject: [PATCH] fix schedule in scheduleMonthlyReboot

---
 .../framework/ubuntu/scheduledjobs/domain/ScheduledJobs.kt   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/framework/ubuntu/scheduledjobs/domain/ScheduledJobs.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/framework/ubuntu/scheduledjobs/domain/ScheduledJobs.kt
index cd67cef..dc41f1d 100644
--- a/src/main/kotlin/org/domaindrivenarchitecture/provs/framework/ubuntu/scheduledjobs/domain/ScheduledJobs.kt
+++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/framework/ubuntu/scheduledjobs/domain/ScheduledJobs.kt
@@ -9,6 +9,7 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.scheduledjobs.infrast
  * ATTENTION: Use with care!! System will be shut down, restart might not succeed in all cases.
  */
 fun Prov.scheduleMonthlyReboot() = task {
-    // reboot each first Tuesday in a month at 3:00
-    createCronJob("50_monthly_reboot", "0 2 1-7 * 2", "/sbin/shutdown", "-r now", "root")
+    // reboot each first Tuesday a month - see https://blog.healthchecks.io/2022/09/schedule-cron-job-the-funky-way/
+    val schedule = "0 2 */100,1-7 * TUE"
+    createCronJob("50_monthly_reboot", schedule, "/sbin/shutdown", "-r now", "root")
 }