here my system info:
$ uname -a
Linux rp4 6.6.51+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt1 (2024-09-26) aarch64 GNU/Linux
All these lines are working directly from command line on RPi4.
18 21 * * * /usr/bin/play /home/user/1.mp3 >/dev/null 2>&1
19 21 * * * /usr/bin/play /home/user/1.mp3
20 21 * * * sh /home/user/playlist.sh
Here is the executable script playlist.sh:
#!/usr/bin/env bash
/usr/bin/play "/home/user/5.m3u"
This one is working
30 21 * * * touch test.txt
What do I do wrong? Thank you :)
goldilocks U DA MAN! By using your hint to redirect the output to a file (I am so stupid not to think about it my self). I got these 3 lines in the file:
couldn't open play stream: Unknown error 524 /usr/bin/play FAIL ao: Could not find a default ao driver /usr/bin/play FAIL sox: Sorry, there is no default audio device configured
By using aplay -l I found my default device. Which is bcm2835 Headphones
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 8/8
Here I found how to set a default device with SOX: https://linux.die.net/man/1/sox
set AUDIODEV=hw:2 in my case export AUDIODEV=hw:2
Here is my final script:
#!/usr/bin/env bash
export AUDIODEV=hw:2
/usr/bin/play "/home/user/5.m3u"