Process Manager
Run LNbits as a persistent service using systemd or PM2 so it starts on boot and restarts on failure.
If you installed LNbits from source (uv, Poetry, Nix) you need a process manager to keep it running. Docker and node platforms handle this automatically.
systemd (Linux)
Create a service file:
ini
# /etc/systemd/system/lnbits.service
[Unit]
Description=LNbits Lightning Wallet
After=network.target
[Service]
Type=simple
User=lnbits
Group=lnbits
WorkingDirectory=/home/lnbits/lnbits
ExecStart=/home/lnbits/lnbits/.venv/bin/lnbits
Restart=always
RestartSec=5
Environment=LNBITS_DATA_FOLDER=/home/lnbits/lnbits/data
[Install]
WantedBy=multi-user.targetEnable and start
bash
sudo systemctl daemon-reload
sudo systemctl enable lnbits
sudo systemctl start lnbitsManage the service
bash
# Check status
sudo systemctl status lnbits
# View logs
sudo journalctl -u lnbits -f
# Restart after config changes
sudo systemctl restart lnbits
# Stop
sudo systemctl stop lnbitsPoetry variant
If you installed with Poetry, change the ExecStart line:
ini
ExecStart=/home/lnbits/lnbits/.venv/bin/poetry run lnbitsPM2 (cross-platform)
PM2 is a Node.js-based process manager that works on Linux, macOS, and Windows.
Install PM2
bash
npm install -g pm2Start LNbits
bash
cd /home/lnbits/lnbits
# If using uv / venv
pm2 start .venv/bin/lnbits --name lnbits
# If using Poetry
pm2 start "poetry run lnbits" --name lnbitsPersist across reboots
bash
pm2 startup
pm2 saveManage the process
bash
# Status
pm2 status
# Logs
pm2 logs lnbits
# Restart
pm2 restart lnbits
# Stop
pm2 stop lnbitsWhich one to choose?
| systemd | PM2 | |
|---|---|---|
| Platform | Linux only | Linux, macOS, Windows |
| Install | Built into Linux | Requires Node.js |
| Log management | journalctl | Built-in log rotation |
| Best for | Production Linux servers | Development, macOS, cross-platform |
TIP
For Docker deployments, the restart: unless-stopped policy in your docker-compose.yml handles restarts - you don't need systemd or PM2.
Related Pages
- Install with uv - source installation
- Install with Poetry - source installation
- Reverse Proxy - set up HTTPS
- First Setup - post-install checklist