Shutdown
Execute system shutdown and reboot actions safely, with explicit confirmation and connection-safety checks.
Core Rules
- - Never run power actions without explicit user confirmation.
- Always confirm target machine and action:
shutdown, reboot, schedule, or cancel. - For remote hosts, warn about session disconnect before executing.
- Prefer delayed shutdown (
+1 minute or equivalent) so cancellation remains possible. - If user asks for immediate action, still echo the exact command and require final confirmation.
- 中文用户常见意图词(如“关机”“重启”“稍后关机”“取消关机”)按同一安全流程处理,不要省略确认步骤。
Workflow
1. Clarify intent and target
Collect and confirm:
- - Target: local machine or remote host
- Action: shutdown or reboot
- Timing: now or scheduled time
- Scope: current machine only (never assume cluster/fleet-wide)
If ambiguous, ask one concise question before running commands.
2. Run pre-checks (read-only)
Use only relevant checks:
- - Linux:
who, uptime, systemctl is-system-running (if systemd exists) - macOS:
who, INLINECODE9 - Windows (PowerShell):
query user, INLINECODE11
If long-running/critical work may be interrupted, report risk and ask whether to continue.
3. Choose platform command
Linux (systemd)
CODEBLOCK0
Fallback where needed:
CODEBLOCK1
macOS
CODEBLOCK2
Windows (PowerShell / cmd)
CODEBLOCK3
4. Confirmation pattern (required)
Before executing state-changing commands, present:
- - Exact command to run
- Expected impact (session disconnect, process termination)
- Cancellation path (if scheduled)
Require the user to reply with a clear confirmation (for example: yes, run it).
中文确认示例:确认执行、是,立即执行。
5. Post-action verification
For scheduled actions, verify and report pending state when possible:
- - Linux/macOS: show relevant
shutdown scheduling output - Windows: confirm command exit output
After reboot requests, explain that reconnect checks should include:
- - Host reachable
- OpenClaw services/processes healthy
- Required ports/listeners restored
Safety Boundaries
- - Do not chain shutdown with destructive cleanup unless user explicitly asks.
- Do not apply shutdown commands to multiple hosts automatically.
- If insufficient privileges, report exact permission error and request elevation approval.
- If command support differs by distro/version, prefer the safest equivalent and state the substitution.
ClawHub Publish Notes
If this skill is published to clawhub.ai, keep updates semver and changelog-driven, and avoid embedding environment-specific hostnames, tokens, or private infrastructure details.
关机
安全执行系统关机与重启操作,需明确确认并检查连接安全性。
核心规则
- - 未经用户明确确认,绝不执行电源操作。
- 始终确认目标机器与操作类型:关机、重启、计划或取消。
- 对于远程主机,在执行前警告会话即将断开。
- 优先使用延迟关机(+1分钟或等效时间),以便仍可取消操作。
- 若用户要求立即执行,仍需回显确切命令并要求最终确认。
- 中文用户常见意图词(如“关机”“重启”“稍后关机”“取消关机”)按同一安全流程处理,不要省略确认步骤。
工作流程
1. 明确意图与目标
收集并确认:
- - 目标:本地机器或远程主机
- 操作:关机或重启
- 时间:立即或计划时间
- 范围:仅限当前机器(切勿假设集群/机群范围)
若存在歧义,在执行命令前提出一个简洁问题。
2. 执行预检查(只读)
仅使用相关检查:
- - Linux:who、uptime、systemctl is-system-running(若存在systemd)
- macOS:who、uptime
- Windows(PowerShell):query user、Get-Uptime
若长时间运行/关键任务可能被中断,报告风险并询问是否继续。
3. 选择平台命令
Linux(systemd)
bash
立即关机
sudo shutdown -h now
立即重启
sudo shutdown -r now
计划1分钟后关机
sudo shutdown -h +1
取消计划关机
sudo shutdown -c
必要时使用备用命令:
bash
sudo systemctl poweroff
sudo systemctl reboot
macOS
bash
立即关机
sudo shutdown -h now
立即重启
sudo shutdown -r now
计划10分钟后关机
sudo shutdown -h +10
取消计划关机
sudo killall shutdown
Windows(PowerShell / cmd)
powershell
立即关机
shutdown /s /t 0
立即重启
shutdown /r /t 0
60秒后关机
shutdown /s /t 60
取消计划关机
shutdown /a
4. 确认模式(必需)
在执行状态变更命令前,展示:
- - 要执行的确切命令
- 预期影响(会话断开、进程终止)
- 取消路径(若为计划操作)
要求用户以明确确认回复(例如:yes, run it)。
中文确认示例:确认执行、是,立即执行。
5. 操作后验证
对于计划操作,尽可能验证并报告待处理状态:
- - Linux/macOS:显示相关shutdown计划输出
- Windows:确认命令退出输出
重启请求后,说明重新连接检查应包括:
- - 主机可达
- OpenClaw服务/进程健康
- 所需端口/监听器已恢复
安全边界
- - 除非用户明确要求,否则不要将关机与破坏性清理操作串联。
- 不要自动将关机命令应用于多个主机。
- 若权限不足,报告确切权限错误并请求提权批准。
- 若命令支持因发行版/版本而异,优先选择最安全的等效命令并说明替换情况。
ClawHub发布说明
若此技能发布至clawhub.ai,请保持语义化版本和变更日志驱动更新,避免嵌入特定环境的主机名、令牌或私有基础设施细节。