I was trying to use my pi and a bluetooth speaker as an alarm clock.
I've setup a cronjob by doing
sudo crontab -e
in the crontab file, I added
40 8 * * 1-5 /home/XXXXX/alarm.sh &> alarm.log
the alarm.sh script is as following:
#!/bin/bash sudo hciconfig hci0 up bluez-test-audio connect MAC_OF_SPEAKER bluez-test-device trusted MAC_OF_SPEAKER yes mplayer -ao alsa:device=clock MY_MUSIC.m4a
The problem now is that the cronjob won't work. If I run the script manually, the speaker plays the .m4a file correctly. But cronjob won't execute at 08:40 in the morning.
Please give me some advice.