# RayClaw systemd service — Ubuntu example
#
# Install:
# sudo cp rayclaw.service.example /etc/systemd/system/rayclaw.service
# sudo systemctl daemon-reload
# sudo systemctl enable --now rayclaw
#
# Before starting, make sure:
# 1. The binary exists at the ExecStart path
# 2. rayclaw.config.yaml is in WorkingDirectory
# 3. The log file is writable:
# sudo touch /var/log/rayclaw.log
# sudo chown YOUR_USER:YOUR_USER /var/log/rayclaw.log
[Unit]
Description=RayClaw AI Bot
Documentation=https://github.com/rayclaw/rayclaw
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=YOUR_USER
Group=YOUR_USER
WorkingDirectory=/opt/rayclaw
ExecStart=/opt/rayclaw/target/release/rayclaw start
# ── Restart policy ──
Restart=always
RestartSec=3
# Give up after 5 consecutive failures within 60s
StartLimitIntervalSec=60
StartLimitBurst=5
# ── Logging ──
StandardOutput=append:/var/log/rayclaw.log
StandardError=append:/var/log/rayclaw.log
# ── Environment ──
Environment=RUST_LOG=info
Environment=HOME=/home/YOUR_USER
# Uncomment to use a custom config path:
# Environment=RAYCLAW_CONFIG=/etc/rayclaw/config.yaml
# ── Graceful shutdown ──
# RayClaw listens for SIGTERM/SIGHUP and drains for 2s
KillSignal=SIGTERM
TimeoutStopSec=10
# ── Resource limits ──
LimitNOFILE=65536
LimitNPROC=4096
# ── Security hardening ──
NoNewPrivileges=true
ProtectHome=read-only
ProtectSystem=strict
# Allow writes to data dir, working dir, and log
ReadWritePaths=/opt/rayclaw/rayclaw.data
ReadWritePaths=/opt/rayclaw/tmp
ReadWritePaths=/var/log/rayclaw.log
PrivateTmp=true
[Install]
WantedBy=multi-user.target