1

I want my RP to initiate PANU mode connection (BT tethering) to my phone. The script should start at boot or after login so it won't hang the booting. I created the following script that works perfectly when launched manually:

#!/bin/sh

test-network <BT address> nap &

Where do I place the script?

1 Answer 1

1

I think the proper solution would be to create a SystemD service, as described here. Create a file named /etc/systemd/system/bt_tether.service:

[Unit]
Description=BT Tethering service
Requires=bluetooth.service
After=bluetooth.service
[Service]
ExecStart=/full/path/to/test-network <BT address> nap
[Install]
WantedBy=multi-user.target

Then run the following command as root:

systemctl enable bt_tether.service
3
  • 1
    I've tried writing a script with a simple command (run a bluez test script) and placed it in bashrc: 'test-network <BT address> nap' It works, it starts after login and if the tethering mode is enabled on my phone, it connects. I like your solution, it's more elegant!
    – alkopop79
    Commented Sep 23, 2016 at 10:57
  • 1
    Anything you put in .bashrc is executed every time you login or open a new shell. If you don't mind if that command gets executed several times, it's OK. Commented Sep 23, 2016 at 11:00
  • Is there a way to launch the command after network is found not available? I guess something with network-online.target ... In other words, if there's no network available on eth0 and wlan0, launch the command.
    – alkopop79
    Commented Sep 23, 2016 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.