Files
pocketpaw/docs/deployment/systemd.mdx
Prakash 57b807c117 docs(seo): optimize titles, descriptions, headings, and cross-links
Comprehensive SEO optimization across 80 documentation pages:

Title optimization (all pages):
- Replaced generic titles like "Architecture", "Discord", "Slack"
  with search-intent titles like "PocketPaw Architecture: Event-Driven
  Message Bus", "Discord Bot Setup: Add PocketPaw to Your Server"
- All titles now 50-70 characters with qualifying keywords

Meta descriptions:
- Expanded 7 short descriptions (under 145 chars) to 150-160 chars
- Roadmap description expanded from 76 to 196 chars
- Troubleshooting, Codex CLI, OpenCode, WebMCP all expanded

H1 heading fixes:
- Ensured single H1 per page matching the frontmatter title
- All H1 headings updated to match new optimized titles

Internal cross-links:
- Added Related CardGroup sections to 60+ individual pages
- Each links to 2-3 related pages within and across sections
- Channels link to channel guides, backends link to Ollama guide, etc.

Em dash cleanup:
- Replaced em dashes with colons, periods, or double hyphens
  across multiple files in tools/, channels/, integrations/

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:41:36 +05:30

160 lines
3.2 KiB
Plaintext

---
title: "Systemd Service: Run PocketPaw as a Daemon"
description: "Run PocketPaw as a systemd service on Linux for automatic startup, restart on failure, and clean shutdown. Includes a complete unit file with security hardening and journal logging setup."
section: Deployment
ogType: article
keywords: ["systemd", "linux service", "auto-start", "daemon", "unit file"]
tags: ["deployment", "systemd", "linux"]
---
# Systemd Service: Run PocketPaw as a Daemon
Run PocketPaw as a background service on Linux with systemd for automatic startup and restart.
## Service File
Create `/etc/systemd/system/pocketpaw.service`:
```ini
[Unit]
Description=PocketPaw AI Agent
After=network.target
[Service]
Type=simple
User=pocketpaw
Group=pocketpaw
WorkingDirectory=/home/pocketpaw
ExecStart=/usr/local/bin/pocketpaw
Restart=on-failure
RestartSec=10
# Environment
EnvironmentFile=/etc/pocketpaw/env
# Security hardening
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=read-only
ReadWritePaths=/home/pocketpaw/.pocketpaw
PrivateTmp=yes
[Install]
WantedBy=multi-user.target
```
## Environment File
Create `/etc/pocketpaw/env`:
```bash
POCKETPAW_ANTHROPIC_API_KEY=sk-ant-your-key
POCKETPAW_DASHBOARD_HOST=127.0.0.1
POCKETPAW_DASHBOARD_PORT=8000
POCKETPAW_AGENT_BACKEND=claude_agent_sdk
POCKETPAW_TOOL_PROFILE=coding
```
Set permissions:
```bash
sudo chmod 600 /etc/pocketpaw/env
sudo chown pocketpaw:pocketpaw /etc/pocketpaw/env
```
## Setup
```bash
# Create dedicated user
sudo useradd -m -s /bin/bash pocketpaw
# Install PocketPaw
sudo -u pocketpaw pip install --user pocketpaw[recommended]
# Create config directory
sudo mkdir -p /etc/pocketpaw
sudo chown pocketpaw:pocketpaw /etc/pocketpaw
# Enable and start service
sudo systemctl daemon-reload
sudo systemctl enable pocketpaw
sudo systemctl start pocketpaw
```
## Managing the Service
```bash
# Start
sudo systemctl start pocketpaw
# Stop
sudo systemctl stop pocketpaw
# Restart
sudo systemctl restart pocketpaw
# Check status
sudo systemctl status pocketpaw
# View logs
sudo journalctl -u pocketpaw -f
# View recent logs
sudo journalctl -u pocketpaw --since "1 hour ago"
```
## Log Rotation
Systemd handles log rotation via journald. For the audit log, add a logrotate config:
```
/home/pocketpaw/.pocketpaw/audit.jsonl {
weekly
rotate 12
compress
missingok
notifempty
copytruncate
}
```
## Auto-Updates
Create a timer for periodic updates:
```ini
# /etc/systemd/system/pocketpaw-update.timer
[Unit]
Description=Update PocketPaw weekly
[Timer]
OnCalendar=weekly
Persistent=true
[Install]
WantedBy=timers.target
```
```ini
# /etc/systemd/system/pocketpaw-update.service
[Unit]
Description=Update PocketPaw
[Service]
Type=oneshot
User=pocketpaw
ExecStart=/usr/local/bin/pip install --upgrade pocketpaw[recommended]
ExecStartPost=/bin/systemctl restart pocketpaw
```
## Related
<CardGroup>
<Card title="Self-Hosting" icon="lucide:server" href="/deployment/self-hosting">
Reverse proxy, SSL, and production hardening for your PocketPaw server.
</Card>
<Card title="Docker Deployment" icon="lucide:container" href="/deployment/docker">
Run PocketPaw in containers with Docker Compose for easier isolation.
</Card>
</CardGroup>