summaryrefslogtreecommitdiff
path: root/rebootcheck.sh
diff options
context:
space:
mode:
Diffstat (limited to 'rebootcheck.sh')
-rwxr-xr-xrebootcheck.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/rebootcheck.sh b/rebootcheck.sh
new file mode 100755
index 0000000..62074f5
--- /dev/null
+++ b/rebootcheck.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+# genesisctl-reboot-check - Lightweight reboot health checker
+
+LAST_BOOT=$(uptime -s 2>/dev/null)
+LAST_BOOT_TS=$(date -d "$LAST_BOOT" +%s)
+NOW_TS=$(date +%s)
+DAYS_SINCE_BOOT=$(( (NOW_TS - LAST_BOOT_TS) / 86400 ))
+
+REBOOT_REQUIRED_FILE="/var/run/reboot-required"
+
+echo "🧠 Genesis Reboot Check"
+echo "-----------------------"
+echo "🕒 Last Boot: $LAST_BOOT"
+echo "📆 Days Since Boot: $DAYS_SINCE_BOOT"
+
+if [ "$DAYS_SINCE_BOOT" -gt 30 ]; then
+ echo "⚠️ Overdue: It's been more than 30 days since your last reboot."
+else
+ echo "✅ Reboot not overdue (monthly policy)"
+fi
+
+if [ -f "$REBOOT_REQUIRED_FILE" ]; then
+ echo "⚠️ System indicates a reboot is required (/var/run/reboot-required exists)"
+else
+ echo "✅ No reboot required by the system"
+fi