07-09-2024, 10:20 PM
(07-09-2024, 09:04 PM)Romanz Wrote:(07-05-2024, 09:00 PM)steve4star Wrote: Why not have a script that checks the status of the mpd_oled service ?
Change the echo to start/stop as appropriate.
Please forgive me, I don't understand programming in the Linux environment at all
Could you please tell me how to do it, or point me in the right direction.
Thanks
Code:
#!/bin/bash
if (systemctl is-active --quiet mpd_oled); then
sudo systemctl stop mpd_oled
else
sudo systemctl start mpd_oled
fi
1. copy the contents in the code-block above into /home/<your username>/bin/mpd_oled_toggle.sh
2. make such file executable: chmod 0777 /home/<your username>/bin/mpd_oled_toggle.sh
3. in the command of the button (just one button, now), specify the whole path as it appears here above, instead of each of the sudo systemctl start/stop ...