mirror of
https://github.com/n0mjs710/HBlink4.git
synced 2026-11-08 12:26:31 +00:00
- Add hblink4.service for main DMR server - Add hblink4-dash.service for web dashboard - Dashboard service depends on main service - Both use venv at /home/cort/hblink4/venv - Auto-restart on failure with 10s delay - Include security hardening (NoNewPrivileges, PrivateTmp) - Log to systemd journal - Add SYSTEMD.md with installation and management instructions
3.1 KiB
3.1 KiB
HBlink4 Systemd Service Installation
This directory contains systemd service files for running HBlink4 and its dashboard as system services.
Service Files
hblink4.service- Main HBlink4 DMR serverhblink4-dash.service- Web dashboard (depends on hblink4.service)
Installation
1. Install the service files
Copy the service files to systemd's system directory:
sudo cp hblink4.service /etc/systemd/system/
sudo cp hblink4-dash.service /etc/systemd/system/
2. Reload systemd
Tell systemd to reload its configuration:
sudo systemctl daemon-reload
3. Enable services (optional)
To start the services automatically at boot:
sudo systemctl enable hblink4
sudo systemctl enable hblink4-dash
4. Start the services
sudo systemctl start hblink4
sudo systemctl start hblink4-dash
Service Management
Check service status
sudo systemctl status hblink4
sudo systemctl status hblink4-dash
View logs
# View logs for HBlink4
sudo journalctl -u hblink4 -f
# View logs for dashboard
sudo journalctl -u hblink4-dash -f
# View last 100 lines
sudo journalctl -u hblink4 -n 100
Stop services
sudo systemctl stop hblink4
sudo systemctl stop hblink4-dash
Restart services
sudo systemctl restart hblink4
sudo systemctl restart hblink4-dash
Disable autostart
sudo systemctl disable hblink4
sudo systemctl disable hblink4-dash
Configuration
The service files are configured to:
- Run as user
cortin groupcort - Use the Python virtual environment at
/home/cort/hblink4/venv - Automatically restart on failure (after 10 seconds)
- Log to systemd journal (view with
journalctl) - Start after network is available
- Dashboard starts after and depends on HBlink4
Customization
If you need to modify the services (different user, paths, etc.), edit the files before copying them:
- Edit
hblink4.serviceand/orhblink4-dash.service - Change
User=,Group=,WorkingDirectory=, orExecStart=as needed - Copy to
/etc/systemd/system/ - Run
sudo systemctl daemon-reload
Security Features
Both services include security hardening:
NoNewPrivileges=true- Prevents privilege escalationPrivateTmp=true- Isolates /tmp directory
Troubleshooting
Service won't start
Check the status and logs:
sudo systemctl status hblink4
sudo journalctl -u hblink4 -n 50
Common issues:
- Virtual environment not found: Check path in
ExecStart= - Permission errors: Ensure user/group are correct
- Config file errors: Check HBlink4 configuration files
- Port conflicts: Another service using the same ports
Dashboard can't connect to HBlink4
- Ensure HBlink4 is running:
sudo systemctl status hblink4 - Check dashboard config points to correct socket/host
- Check logs:
sudo journalctl -u hblink4-dash -n 50
Notes
- The dashboard service has
Wants=hblink4.service, so it will start after HBlink4 - Both services have
Restart=alwaysfor automatic recovery - Logs are sent to systemd journal, not file-based logging
- Services run with the same privileges as the
cortuser