Skip to main content

Overview

Running PicoClaw as a systemd service ensures it starts automatically on boot and restarts if it crashes. This is ideal for production deployments, embedded devices, and servers.

Prerequisites

  • PicoClaw installed (see Installation Guide)
  • Linux system with systemd (most modern distributions)
  • Root or sudo access

Creating a systemd Service

1. Create Service File

Create a systemd unit file at /etc/systemd/system/picoclaw.service:

2. Basic Service Configuration

Add this configuration:

3. Create Dedicated User

For security, run PicoClaw as a dedicated user:

4. Set Up Configuration

Copy your configuration to the service user’s directory:

5. Enable and Start Service

Managing the Service

Check Service Status

Example output:

View Logs

Stop the Service

Restart the Service

Disable Auto-Start

Advanced Configuration

Running as Your User

If you prefer to run as your own user instead of a dedicated picoclaw user:
Install as a user service:

Environment Variables

Customize paths and settings using environment variables:

Resource Limits

Limit resource usage:

Restart Policy

Customize restart behavior:

Multiple Instances

Run multiple PicoClaw instances with different configs:

1. Create Template Service

Create /etc/systemd/system/picoclaw@.service:

2. Create Instance Configs

3. Start Instances

Monitoring

Health Checks

Create a health check script:
Make it executable:
Run via cron every 5 minutes:

Prometheus Metrics

If you’re using Prometheus, you can monitor systemd services:
Add:

Troubleshooting

Service Won’t Start

Check the service status and logs:
Common issues:
  • Config file missing: Verify path in Environment="PICOCLAW_CONFIG=..."
  • Permission denied: Check file ownership and permissions
  • Binary not found: Verify ExecStart path

Service Stops Unexpectedly

Configuration Changes Not Applied

After editing the service file:

Port Already in Use

If the gateway port (default 18790) is in use:

Security Best Practices

File Permissions

Systemd Security Features

Add to [Service] section:

Next Steps