360 Secure SkillHub
360 安全技能中心

Reboot Checker

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

hostilespider
hostilespider
热度 40.15
最近更新 2026-05-11 17:38:03
分类:安全依赖:代码执行 / 读写文件应用场景:自动化脚本 / DevOps / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add 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