Moode Forum
Test whether Moode startup has completed from systemd service file - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: Test whether Moode startup has completed from systemd service file (/showthread.php?tid=5556)

Pages: 1 2


RE: Test whether Moode startup has completed from systemd service file - fdealexa - 05-04-2023

hi Adrian,
I have test several configurations and i think that the following could be fine. Would you please be so kind to test it and let me know your comments?

Code:
[Unit]
Description=MPD OLED Display
After=network.target sound.target mpd.service
Requires=mpd.service

[Service]
ExecStart=/usr/bin/mpd_oled  -o 6 -b 32 -g 1 -f 50 -c alsa,plughw:Loopback,1
TimeoutSec=3min

[Install]
WantedBy=multi-user.target

Best regards and thanks,
Francesco


RE: Test whether Moode startup has completed from systemd service file - fdealexa - 05-04-2023

(05-04-2023, 04:29 PM)adrii Wrote: Hi Francesco

On Volumio and RuneAudio the mpd_oled service waits for mpd to be running before starting mpd_oled. On Moode there is a flag to say that the system startup has completed, and it should help avoid issues to wait for it to be set before running mpd_oled.


Adrian.

Sorry Adrian,
I missed this message before to send mine.


RE: Test whether Moode startup has completed from systemd service file - adrii - 05-09-2023

(05-03-2023, 04:55 PM)adrii Wrote: This is essentially working. mpd_oled starts correctly at boot, the service can be started and stopped. The only issue is that stopping the service now leaves some pixels lit on the OLED, so it appears that when the service stops a script that runs mpd_oled it is not the same as when the service directly stops the mpd_oled process. I can probably fix this with an ExecStop in the service file to stop the mpd_oled process with an appropriate signal.

I found a natural solution, which is to run mpd_oled with 'exec' at the end of the launch script. This allows the mpd_oled process to receive the SIGTERM signal sent by systemd when it stops the service, and mpd_oled can then clear the OLED display before it shuts down, just like when it is run directly by the service.

Adrian.