RR Reboot Report
Detect unexpected reboots and track boot history. Useful for security monitoring — flags when a system restarts unexpectedly.
Quick Start
CODEBLOCK0
How It Works
- 1. On first run, records current boot time to state file
- On subsequent runs, compares current boot time with last known
- If boot time changed unexpectedly → alerts
- State file:
~/.reboot-check-state (customizable with --state)
Output
CODEBLOCK1
Integration
Auto-Alert via Cron (Recommended)
For automatic Telegram alerts on reboot without needing the agent active:
1. Create config file (one-time setup):
CODEBLOCK2
2. Add to crontab:
CODEBLOCK3
The reboot-alert.sh helper script:
- - Detects reboots automatically
- Reads credentials from
~/.rr-reboot-config (user-created, isolated config) - Sends alert via Telegram Bot API directly
- Waits for network at boot
- Resets state after alert
No credentials stored in the script or skill files. All user-provided.
Heartbeat Integration
CODEBLOCK4
Options
- -
--state FILE — State file path (default: ~/.reboot-check-state) - INLINECODE6 — Show recorded boot history
- INLINECODE7 — Reset state to current boot
- INLINECODE8 — Output as JSON
RR 重启报告
检测意外重启并追踪启动历史。适用于安全监控——当系统意外重启时发出警报。
快速开始
bash
检查意外重启(在启动时或首次心跳时运行)
bash {baseDir}/scripts/check-reboot.sh
查看启动历史
bash {baseDir}/scripts/check-reboot.sh --history
重置状态(将当前启动标记为已知)
bash {baseDir}/scripts/check-reboot.sh --reset
工作原理
- 1. 首次运行时,将当前启动时间记录到状态文件
- 后续运行时,将当前启动时间与上次已知时间进行比较
- 如果启动时间意外变化 → 发出警报
- 状态文件:~/.reboot-check-state(可通过 --state 自定义)
输出
STATUS: CLEAN — 自上次检查以来未重启
STATUS: REBOOTED — 自上次检查以来系统已重启
STATUS: FIRST_RUN — 首次运行,正在记录启动时间
集成
通过 Cron 自动警报(推荐)
无需代理活跃即可在重启时自动发送 Telegram 警报:
1. 创建配置文件(一次性设置):
bash
cat > ~/.rr-reboot-config << EOF
BOTTOKEN=yourbottokenhere
CHATID=yourchatidhere
EOF
chmod 600 ~/.rr-reboot-config
2. 添加到 crontab:
bash
@reboot /path/to/scripts/reboot-alert.sh
reboot-alert.sh 辅助脚本:
- - 自动检测重启
- 从 ~/.rr-reboot-config 读取凭据(用户创建,独立配置)
- 直接通过 Telegram Bot API 发送警报
- 启动时等待网络连接
- 警报后重置状态
脚本或技能文件中不存储任何凭据。全部由用户提供。
心跳集成
bash
在心跳脚本中
RESULT=$(bash check-reboot.sh)
[[ $RESULT ==
REBOOTED ]] && echo 警报:检测到意外重启!
选项
- - --state FILE — 状态文件路径(默认:~/.reboot-check-state)
- --history — 显示记录的启动历史
- --reset — 将状态重置为当前启动
- --json — 以 JSON 格式输出