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
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 dedicatedpicoclaw user:
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/[email protected]:
2. Create Instance Configs
3. Start Instances
Monitoring
Health Checks
Create a health check script:Prometheus Metrics
If you’re using Prometheus, you can monitor systemd services:Troubleshooting
Service Won’t Start
Check the service status and logs:- Config file missing: Verify path in
Environment="PICOCLAW_CONFIG=..." - Permission denied: Check file ownership and permissions
- Binary not found: Verify
ExecStartpath
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
- Monitor with journalctl
- Advanced systemd configuration
- Configure Chat Apps - Connect messaging platforms
- Environment Variables - Customize runtime settings