# bluetooth-reconnect Inspired by [bluetooth-autoconnect](https://github.com/jrouleau/bluetooth-autoconnect), but much simplier and actually works. Based on systemd service (daemon) which does the following, repeatedly: 1. Run check command (e.g. check if device exists). If it returns zero, continue. 2. Try to run `bluetoothctl connect `. No checks if bluetooth is on, etc. Dead simple. 3. Sleep for `delay` seconds (configurable). ## How to install ``` git clone https://gist.github.com/bc178789a441ce73b51e1e0637393aac.git bluetooth-reconnect && cd bluetooth-reconnect sudo chmod +x bluetooth-reconnect # Edit `bluetooth-reconnect` file according to your needs. Try if it works with ./bluetooth-reconnect sudo cp bluetooth-reconnect /usr/bin sudo cp bluetooth-reconnect.service /etc/systemd/system sudo systemctl enable bluetooth-reconnect sudo systemctl start bluetooth-reconnect # Check if it's alive sudo systemctl status bluetooth-reconnect ``` ## References - How `test` command works: https://www.computerhope.com/unix/test.htm - How to loop with equal invervals: https://unix.stackexchange.com/a/214660