I’m running Debian Bullseye. I have a super-simple script that connects the computer to a bluetooth receiver and sets that receiver to be the default pulseaudio “sink”. I want the script to run when the computer resumes from suspend, or when I log in - I don’t really care which.
Here’s the script:
Code: Select all
#!/bin/bash
touch /home/me/BTC1
# The above line is to create a “footprint” to show whether the script has executed.
bluetoothctl < /usr/local/bin/BTconnect.txt
sleep 8
# The sleep command is because sometimes the next line,
# the pacmd, would report that the sink doesn’t exist.
# I’m not sure the delay cures it, but that's a different issue.
pacmd set-default-sink bluez_sink.NN_NN_NN_NN_NN_NN.a2dp_sink
# The NN's aren't the real address of course.
exit 0
/lib/systemd/system-sleep/
/usr/lib/pm-utils/sleep.d/
/etc/profile.d/
I tried appending the guts of the script to an existing file, /home/Will/.profile.
I tried placing the following line at the end of another existing file, /etc/pam.d/login.
Code: Select all
session optional pam_exec.so /bin/bash /usr/local/bin/connect-AIS0F.sh
Code: Select all
bash /usr/local/bin/connect-AIS0F.sh
None of these attempts worked at all. None of them created the “touched” file BTC1.
What am I missing / doing wrong?
Thanks much for your ideas.