360 Secure SkillHub
360 安全技能中心

Reboot Checker

通过 Bash 脚本记录当前启动时间并与上次比较,判断是否发生异常重启;支持查看历史、重置状态和 JSON 输出,便于配合定时任务或心跳脚本触发告警。

分类:安全
hostilespider
hostilespider
热度 26.65
最近更新 2026-05-11 17:38:03

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add hostilespider/reboot-checker
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
reboot-checker
description
Detect unexpected system reboots and alert when the system comes back online. Tracks boot history and flags suspicious restarts.
metadata
{"openclaw":{"emoji":"🔄","requires":{"bins":["bash"]}}}

Reboot Checker

Detect unexpected reboots and track boot history. Useful for security monitoring — flags when a system restarts unexpectedly.

Quick Start

# Check for unexpected reboot (run at startup or on first heartbeat)
bash {baseDir}/scripts/check-reboot.sh

# View boot history
bash {baseDir}/scripts/check-reboot.sh --history

# Reset state (mark current boot as known)
bash {baseDir}/scripts/check-reboot.sh --reset

How It Works

  1. On first run, records current boot time to state file
  2. On subsequent runs, compares current boot time with last known
  3. If boot time changed unexpectedly → alerts
  4. State file: ~/.reboot-check-state (customizable with --state)

Output

STATUS: CLEAN       — No reboot since last check
STATUS: REBOOTED    — System rebooted since last check
STATUS: FIRST_RUN   — First time running, recording boot time

Integration

Use with cron or heartbeat systems:

# Cron: check every hour
0 * * * * /path/to/check-reboot.sh >> /var/log/reboot-check.log

# Or in a heartbeat script
RESULT=$(bash check-reboot.sh)
[[ "$RESULT" == *"REBOOTED"* ]] && echo "ALERT: Unexpected reboot!"

Options

  • --state FILE — State file path (default: ~/.reboot-check-state)
  • --history — Show recorded boot history
  • --reset — Reset state to current boot
  • --json — Output as JSON