diff options
| author | doc <doc@filenotfound.org> | 2025-09-16 11:30:38 +0000 |
|---|---|---|
| committer | doc <doc@filenotfound.org> | 2025-09-16 11:30:38 +0000 |
| commit | 5cfeb2cf156705349730bdc6ce883fd8eb22e728 (patch) | |
| tree | 13758f78513ed74198d2257c11c0ef9a913725d1 /rebootcheck.sh | |
Diffstat (limited to 'rebootcheck.sh')
| -rwxr-xr-x | rebootcheck.sh | 26 |
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 |
