start a service after bluetooth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a sound bar which is using bluetooth. My problem is that while my machine (Fedora 33) starts and bluetooth is starting, it doesn't auto pair and I have to click "connect" manually each boot.

So I'm trying to create a workaround. I've created a simple systemd file which runs a script that uses bluetoothctl to pair between the two.

My systemd file looks like this:

[Unit]
Description=Fix Pulse Audio
After=bluetooth.target
Requisite=bluetooth.target

[Service]
ExecStart=/usr/local/bin/fixaudio.sh
User=hetz
Type=Simple

[Install]
WantedBy=multi-user.target bluetooth.target

My script (fixaudio.sh):

#!/bin/bash

sleep 3
echo "Trying to pair...."
rm -f /tmp/fix.log
bluetoothctl connect C4:30:18:A0:2F:33 > /tmp/fix.log

The problem: any time I try to restart the bluetooth service, it ignores this systemd file (and yes, it's enabled and I ran systemctl daemon-reload)

I tried to edit the bluetooth.service file and add BindsTo=fix.service (which is the name of the systemd file), but as soon as I ran the systemctl daemon-reload - it restarted the bluetooth in a loop.

Any suggestions?

Thanks
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux