mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-05-16 02:13:32 +00:00
Change After=network.target → After=network-online.target + Wants=network- online.target in both service templates and install_web_service.sh. network.target only guarantees NetworkManager has started — it does NOT mean the device has an active internet connection. On boot the LED matrix service was starting within seconds of the network interface appearing, before WiFi association and DHCP completed, causing every first-update API call to fail with "Network is unreachable" or DNS resolution errors. network-online.target waits for a confirmed route before the service fires. On Raspberry Pi OS this is provided by NetworkManager-wait-online. The tradeoff is a few extra seconds at boot, acceptable for a display device. Observed on devpi: service started at 14:48:03, all API calls (weather, FlightRadar24, local ADS-B) failed at 14:48:07 with network errors, then the service restarted cleanly at 14:50:40 once WiFi was established. Co-authored-by: Chuck <chuck@example.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Systemd Service Files
This directory contains systemd service unit files for LEDMatrix services.
Service Files
-
ledmatrix.service- Main LED Matrix display service- Runs the display controller (
run.py) - Starts automatically on boot
- Runs as root for hardware access
- Runs the display controller (
-
ledmatrix-web.service- Web interface service- Runs the web interface conditionally based on config
- Starts automatically on boot if
web_display_autostartis enabled - Uses
scripts/utils/start_web_conditionally.py
-
ledmatrix-wifi-monitor.service- WiFi monitor daemon service- Monitors WiFi/Ethernet connectivity
- Automatically enables/disables access point mode
- Uses
scripts/utils/wifi_monitor_daemon.py
Installation
These service files are installed by the installation scripts in scripts/install/:
install_service.shinstallsledmatrix.serviceinstall_web_service.shinstallsledmatrix-web.serviceinstall_wifi_monitor.shinstallsledmatrix-wifi-monitor.service
Manual Installation
Important: the unit files in this directory contain
__PROJECT_ROOT_DIR__placeholders that the install scripts replace with the actual project directory at install time. Do not copy them directly to/etc/systemd/system/— the service will fail to start withWorkingDirectory=__PROJECT_ROOT_DIR__errors.Always install via the helper script:
sudo ./scripts/install/install_service.shIf you really need to do it by hand, substitute the placeholder first:
PROJECT_ROOT="$(pwd)" sed "s|__PROJECT_ROOT_DIR__|$PROJECT_ROOT|g" systemd/ledmatrix.service \ | sudo tee /etc/systemd/system/ledmatrix.service > /dev/null sudo systemctl daemon-reload sudo systemctl enable ledmatrix.service sudo systemctl start ledmatrix.service
Service Management
# Check status
sudo systemctl status ledmatrix.service
# Start/stop/restart
sudo systemctl start ledmatrix.service
sudo systemctl stop ledmatrix.service
sudo systemctl restart ledmatrix.service
# Enable/disable autostart
sudo systemctl enable ledmatrix.service
sudo systemctl disable ledmatrix.service
# View logs
journalctl -u ledmatrix.service -f