Development v1.0.0

pm2-gateway-restart

Use PM2 to reliably restart OpenClaw gateway on Windows. Use when the user wants to restart the OpenClaw gateway, fix...

zitao666 更新于 2026-03-25 1 浏览
下载 SKILL

技能说明

Use PM2 to reliably restart OpenClaw gateway on Windows. Use when the user wants to restart the OpenClaw gateway, fix port conflicts, or recover from a crashed gateway. This skill handles the Windows-specific issues with FIN_WAIT_2 TCP connections and scheduled task failures that plague the standard openclaw gateway start/stop commands.

使用场景

This skill provides reliable gateway restart using PM2 process manager instead of the built-in openclaw gateway commands.

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

帮我下载并安装这个SKILL:https://skillhub.cstcloud.cn/download/pm2-gateway-restart
  1. 点击上方「下载 SKILL」按钮,获取技能压缩包。
  2. 将压缩包解压到你的 Agent 技能目录。
  3. 重启客户端后即可在技能列表中选择该技能。

技能文件内容

4 个文件 · 18 kB
SKILL.md text/markdown
---
name: pm2-gateway-restart
description: Use PM2 to reliably restart OpenClaw gateway on Windows. Use when the user wants to restart the OpenClaw gateway, fix port conflicts, or recover from a crashed gateway. This skill handles the Windows-specific issues with FIN_WAIT_2 TCP connections and scheduled task failures that plague the standard openclaw gateway start/stop commands.
---

# PM2 Gateway Restart

This skill provides reliable gateway restart using PM2 process manager instead of the built-in openclaw gateway commands.

## Why PM2?

The standard `openclaw gateway start/stop` commands on Windows suffer from:
- FIN_WAIT_2 TCP connection timeouts (~60 seconds)
- Scheduled task race conditions
- Inconsistent startup state reporting

PM2 handles process resurrection and provides reliable restarts.

## Commands

### Quick Restart (Production)
```powershell
pm2 restart openclaw-gateway
```
Wait ~15 seconds for the gateway to fully initialize, then verify with:
```powershell
curl http://127.0.0.1:18789/
```

### Full Cycle Restart (When Issues Persist)
```powershell
pm2 restart openclaw-gateway; sleep 3; pm2 restart openclaw-gateway
```

### Check Status
```powershell
pm2 status
pm2 logs openclaw-gateway --lines 50
```

### Start Gateway (If Not Running)
```powershell
pm2 start "D:/Program Files/nodejs/node.exe" --name "openclaw-gateway" -- "C:/Users/Administrator/AppData/Roaming/npm/node_modules/openclaw/dist/index.js" gateway --port 18789
```

## Troubleshooting

### Port Still in Use After Restart
Wait 65 seconds for Windows TCP timeout to clear FIN_WAIT_2 connections, then:
```powershell
pm2 restart openclaw-gateway
```

### RPC Probe Fails But Gateway Listening
The RPC check may fail briefly during startup. Wait 15 seconds and retry:
```powershell
curl http://127.0.0.1:18789/
```

### PM2 Process Not Found
Reinstall the gateway process:
```powershell
pm2 start "D:/Program Files/nodejs/node.exe" --name "openclaw-gateway" -- "C:/Users/Administrator/AppData/Roaming/npm/node_modules/openclaw/dist/index.js" gateway --port 18789
pm2 save
```

## Setup (One Time)
```powershell
npm install -g pm2
pm2 start "D:/Program Files/nodejs/node.exe" --name "openclaw-gateway" -- "C:/Users/Administrator/AppData/Roaming/npm/node_modules/openclaw/dist/index.js" gateway --port 18789
pm2 save
```

文件内容直接读取自技能仓库,仅供安装前审阅;以实际下载的压缩包为准。