Nimbin[12]?Administration / bluetooth.sh

bluetooth.sh Administration

This script activates your bluetooth service.
It also powers on bluetoothctl.
To use it type:
bluetooth.sh on

wget https://git.christianimmanuel.de/scripts/raw/Administration/bluetooth.sh && chmod 740 bluetooth.sh
bluetooth.sh 863 B · 34 lines raw
#!/bin/bash

##################################################
### This script activates your bluetooth service.
### It also powers on bluetoothctl.
### To use it type:
### bluetooth.sh on

[[ -L "/sbin/init" ]] && sys='systemd' || sys='systemV'
on() {
   if [[ "$sys" = "systemV" ]]; then
      sudo /etc/rc.d/rc.bluetooth start
   elif [[ "$sys" = "systemd" ]]; then
      sudo systemctl start bluetooth.service
      sudo systemctl start bluealsa.service
   else
      echo "Init system unkown" && exit
   fi
   echo -e "power on" | bluetoothctl
}

off() {
   echo -e "power off" | bluetoothctl
   if [[ "$sys" = "systemV" ]]; then
      sudo /etc/rc.d/rc.bluetooth stop
   elif [[ "$sys" = "systemd" ]]; then
      sudo systemctl stop bluetooth.service
      sudo systemctl stop bluealsa.service
   else
      echo "Init system unkown" && exit
   fi
}

"$@"