Vibe Coding Academy Logo Vibe Coding Academy

Restart OpenClaw on a VPS

Force stop the parent process, prevent respawns, and restart the gateway cleanly — with a ready-to-use kill script.

Published February 6, 2026 · 7 min read

If OpenClaw is stuck, respawning, or ignoring your kill commands, you’re not alone. The key detail: OpenClaw runs a parent process that supervises the gateway. Kill only the child and it comes right back.

⚠️ Disclaimer

This guide includes terminal commands that stop running processes. These instructions are provided as-is and run at your own risk. OpenClaw builds and commands can change over time, so what worked for me may not work for everyone. Make sure you understand each command before running it, and take responsibility for any impact on your system.

⚠️ Why It Won’t Stop

The OpenClaw parent process respawns the openclaw-gateway child. You must stop the parent first or it will immediately restart the gateway.

Step 1: Check If OpenClaw Is Running

pgrep -f openclaw || echo "no openclaw running"

Optional port check:

ss -lptn | grep 18789 || echo "gateway not listening"

Step 2: Identify Parent and Child PIDs

ps aux | grep -i '[o]penclaw'

Pick a PID and locate the parent:

ps -o pid,ppid,cmd -p <PID>

Step 3: Correct Manual Shutdown

Kill the parent first, then clean up any children:

kill -TERM <PPID> sleep 2 kill -KILL <PPID>
pkill -9 -f openclaw

Confirm it’s fully stopped:

pgrep -f openclaw || echo "fully stopped"

Step 4: Use the Kill Script (Recommended)

Create a one-command kill script so you never hunt for PIDs again:

nano kill-openclaw.sh

Paste the script:

#!/usr/bin/env bash echo "Stopping OpenClaw..." PIDS=$(pgrep -f openclaw) if [ -z "$PIDS" ]; then echo "No OpenClaw processes running" exit 0 fi for PID in $PIDS; do PARENT=$(ps -o ppid= -p "$PID" 2>/dev/null | tr -d ' ') if [ -n "$PARENT" ] && [ "$PARENT" -ne 1 ]; then kill -TERM "$PARENT" 2>/dev/null fi done sleep 2 pkill -9 -f openclaw pgrep -f openclaw || echo "fully stopped"

Enable and run it:

chmod +x kill-openclaw.sh ./kill-openclaw.sh

Step 5: Restart OpenClaw

If you launch OpenClaw manually, start it with:

openclaw tui

If you run the gateway as a service, use the built-in restart command:

openclaw gateway restart

Optional status check:

openclaw gateway status

Step 6: Manual Start (When OpenClaw Won't Restart)

Sometimes OpenClaw won't start automatically. In this case, you'll need to start it manually and trigger a session spawn.

⚠️ Important

This is a temporary workaround. After triggering the session, you'll need to kill the manually-started processes and let OpenClaw run normally.

1

Start OpenClaw Manually

Launch the gateway with these flags:

openclaw gateway run --port 18789 --bind loopback --allow-unconfigured

Leave this running in the terminal.

2

Trigger Session Spawn

Open a new SSH session to your VPS and run:

openclaw tui

This will show the terminal UI and trigger OpenClaw to spawn a new session on its own.

3

Identify Processes

Check which OpenClaw processes are running:

ps aux | grep -i openclaw | grep -v grep

You may see multiple sessions like:

root 230003 0.0 ... pts/0 Sl+ ... openclaw root 230010 2.1 ... pts/0 Sl+ ... openclaw-gateway root 230332 41.4 ... ? Ssl ... openclaw-gateway
4

Kill Manual Processes

Kill the first two processes (manually started), but leave the last one running:

kill 230010 230003

Note: Replace the PIDs with your actual process IDs from the previous step.

5

Verify Only One Process Remains

Confirm only the auto-spawned gateway is running:

ps aux | grep -i openclaw | grep -v grep

Expected output (single process):

root 241951 1.4 4.5 12189456 371932 ? Ssl 01:52 0:08 openclaw-gateway

✅ Success

OpenClaw is now running normally with the auto-spawned gateway process.

Step 7: Verify After Restart

ss -lptn | grep 18789 openclaw gateway call config.get --params '{}' | grep '"primary"'

✅ Golden Rule

If OpenClaw respawns, you didn’t kill the parent.

Want More OpenClaw Troubleshooting?

Join Vibe Coding Academy for step-by-step guides, real-world fixes, and a community of builders shipping with AI.

Join the Academy

Key Takeaways

Abdul Khan
Written by
Abdul Khan