summaryrefslogtreecommitdiff
path: root/rebootcheck.sh
blob: 62074f5a8a421d2d0170ae7c47c43f229e33bd80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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