Thank you for your excellent guidance so far. Your instructions were successful in getting the script to run and bypass all the previous errors.
The custom.sh script is now running on boot, but I am facing a new and very specific error with the audio output. It seems to be a problem with the ALSA device.
The system gives the error: “Audio output failed The audio device “hw:0,0” could not be used: No such file or directory” and “Cannot open ALSA device ‘hw:0,0’: No such file in the directory”.
Here is the code in my custom.sh file, which is based on your last instructions:
#!/usr/bin/env bash
while true
do
/usr/bin/cvlc --aout=alsa --alsa-audio-device=hw:0,0 --play-and-exit "https://stream.amfm.link:8010/kjm"
sleep 10
done
It seems that the hw:0,0 device is not correct on my system. Can you please advise on how to find the correct ALSA device, or why the system would report that hw:0,0 does not exist?
Thank you so much for your initial guidance. I am happy to report that the issue is now completely solved.
The problem turned out to be a combination of two things: a file path issue and a VLC configuration problem. Your advice to use a single script was the key that got us on the right path.
The main issue was that the dietpi-autostart process was looking in a different directory for the script than where I had created it.
Here is the final, working script that is in my /var/lib/dietpi/dietpi-autostart/custom.sh file. It addresses the file path issue, the VLC permissions, and the specific audio device on my unit:
Bash
#!/usr/bin/env bash
while true
do
/usr/bin/cvlc --aout=alsa --alsa-audio-device=plughw:SB,0 -I dummy --play-and-exit --quiet "https://stream.amfm.link:8010/kjm"
sleep 10
done
Thank you again for your help and for setting me on the right track. This project is now fully functional.