Ops errors
systemd and journalctl for a Python trading bot
If you only start the bot in an SSH window, it dies when you disconnect. systemd is the boring process manager. journalctl is how you see why it died.
This is operations, not a strategy. A healthy service only means the process is up. It does not mean the bot should be live.
Minimum unit
[Unit] Description=OpenClaw trading bot After=network-online.target Wants=network-online.target [Service] User=YOURUSER WorkingDirectory=/home/YOURUSER/bots/openclaw ExecStart=/home/YOURUSER/bots/openclaw/.venv/bin/python main.py Restart=on-failure RestartSec=10 EnvironmentFile=/home/YOURUSER/bots/openclaw/.env [Install] WantedBy=multi-user.target
- ExecStart must be the venv python, not system python.
- User must own the folder and the .env file.
- Restart=always can hide a crash loop. on-failure is easier to debug.
Install and start
sudo cp openclaw.service /etc/systemd/system/openclaw.service sudo systemctl daemon-reload sudo systemctl enable --now openclaw systemctl status openclaw --no-pager
Read the logs
journalctl -u openclaw -e journalctl -u openclaw -f journalctl -u openclaw --since "10 min ago"
-e jumps to the end. -f follows like tail. If status says activating (auto-restart) you are in a crash loop — read the last 30 lines before you restart again.
Common failures
What the log usually means
- ModuleNotFoundError — ExecStart is not the venv.
- Permission denied: .env — wrong User= or chmod.
- inactive (dead) after logout — you never enabled the unit; you ran python in SSH.
- status=1/FAILURE every 10s — the script is crashing on import or missing env.
Do not set Restart=always and walk away on a live key. A crash loop can hammer the exchange. Fix the log first. Keep DRY_RUN=true until the unit stays active for a full scan interval.
Get the full walkthrough
The paid guide includes the source, config template, and deploy script. 50% off: $19.99 (was $39.99). One-time.
Get the ebook — $19.99Educational product. Trading can lose money. Not financial advice.