Update README to include systemd service setup and remove rc.local script

This commit is contained in:
audioprog 2025-08-29 22:07:16 +02:00
parent 958eb59537
commit 5f44d76bed
2 changed files with 69 additions and 8 deletions

View file

@ -51,7 +51,75 @@ Alle 2 Sekunden wird ein JSON wie folgt gesendet:
- Bei fehlender Verbindung wird automatisch reconnectet. - Bei fehlender Verbindung wird automatisch reconnectet.
- Fehler beim Senden werden geloggt, blockieren aber nicht den Hauptloop. - Fehler beim Senden werden geloggt, blockieren aber nicht den Hauptloop.
rc.local script to start LoudnessSpy on boot ## Autostart
To set up LoudnessSpy to start automatically using systemd on Raspberry Pi OS Lite, you can create a systemd service file. Heres how to do that:
Steps to Create a systemd Service for LoudnessSpy
Open a Terminal:
You should already be in the terminal since you're using Raspberry Pi OS Lite.
Create a systemd Service File:
Use the following command to create a new service file:
```bash
sudo nano /etc/systemd/system/loudnessspy.service
```
Add the Following Content:
In the opened file, add the following lines:
```ini
[Unit]
Description=LoudnessSpy Service
After=network.target
[Service]
ExecStart=/opt/loudnessspy/loudnessspy
Restart=always
User=pi
Environment=DISPLAY=:0
[Install]
WantedBy=multi-user.target
```
ExecStart: This is the command to start your application.
Restart=always: This ensures that the service restarts if it crashes.
User=pi: Replace pi with the appropriate user if necessary.
Save and Exit:
Press CTRL + X, then Y, and hit Enter to save the changes and exit the editor.
Reload systemd to Recognize the New Service:
Run the following command to reload the systemd manager configuration:
```bash
sudo systemctl daemon-reload
```
Enable the Service to Start on Boot:
Use the following command to enable the service:
```bash
sudo systemctl enable loudnessspy.service
```
Start the Service Immediately (optional):
If you want to start the service right away without rebooting, run:
```bash
sudo systemctl start loudnessspy.service
```
Check the Status of the Service:
You can check if the service is running with:
```bash
sudo systemctl status loudnessspy.service
```
Reboot Your Raspberry Pi:
Restart your Raspberry Pi to ensure that the service starts automatically:
```bash
sudo reboot
```
After following these steps, LoudnessSpy should launch automatically when your Raspberry Pi boots up using systemd. If you encounter any issues, check the service status for error messages and ensure that the paths and permissions are correct.
--- ---
Autor: Leonhard Suckau Autor: Leonhard Suckau

View file

@ -1,7 +0,0 @@
#!/bin/sh -e
# rc.local
# Start LoudnessSpy
/opt/loudnessspy/loudnessspy &
exit 0