4

I would like to start / stop bluetooth service automatically when I turn on / off rfswitch, is that possible ?

3

Yes. Assuming you have udev, something like the following would be a decent start:

# /etc/udev/rules.d/10-rfkill.rules
SUBSYSTEM=="rfkill", ATTR{type}=="wlan", RUN+="/usr/local/bin/toggle-blue"

And then:

#!/bin/bash
#/usr/local/bin/toggle-blue

if [ ${RFKILL_STATE} = 2 -o ${RFKILL_STATE} = 0 ]; then
    (
    /etc/rc.d/bluetooth stop
    ) &
else
    (
    /etc/rc.d/bluetooth start
    ) &
fi

See the relevant man pages for more info ... you can do a lot with udev rules (although it can be a little overwhelming to learn).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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