This paste expires on 2023-04-12 18:35:54.244471. Repaste, or download this paste. . Pasted through web.

#!/bin/bash
#set -x
allbluedaemon=$(sudo systemctl | grep bluetooth)
restartblue='sudo systemctl restart bluetooth'
#daemonbluestat='sudo systemctl status bluetooth'
startb='sudo systemctl start bluetooth'
activeblueiso=$(sudo systemctl status bluetooth | grep active)
inactiveblueiso=$(sudo systemctl status bluetooth | grep inactive)
#searchmanager=$(ps aux | grep blue-manager)
echo "Checking on the status of bluetooth processes ..."
sleep 3
if  echo $inactiveblueiso > /dev/null ; then
    echo "Bluetooth daemon not running - bringing up daemon and firing up Bluetooth manager now ..."
    $startb
    blueman-manager & #--no-tray
else         #elif  echo $auxbluetooth > /dev/null ; then  
    echo ------------------------------------------------------------------
    echo -e "Bluetooth daemon running but more tests need to be performed if audio Does not exist...."
    sleep 4
    echo ------------------------------------------------------------------
    #echo $auxbluetooth > /dev/null &&
    echo "Searching for all active bluetooth processes. One moment, please  ..."
    echo  ----------------------------------------------------------------
    sleep 4
    echo $allbluedaemon   #sudo systemctl | grep bluetooth
    echo -------------------------------------------------------------------
    echo "Take note of the processes above and perform more tests of needed"
    echo "The most important daemon is 'bluetooth.service' - the main bluetooth process"
fi
read -r -p "Do you still need to enable the bluetooth daemon? Please type yes or no: " response
if [[ $response = "yes" ]] ; then
    echo --------------------------------------------------------------------
    echo "Restarting bluetooth daemon now..."
    sleep 4
    $restartblue  #sudo systemctl restart bluetooth
    sleep 3
    #echo "Take note of the status below"
    echo --------------------------------------------------------------------
printf "A few final steps may need to be performed regardless in order to re-pair your device.\n1.) click on the blueooth icon at the top right of the task bar above for the Bluetooth manager to open\n2.) On the drop down menu, select 'Devices' if necessary.\n3.) Disconnect and reconnect your device if needed.\nMore tests may be required and you may need to turn your bluetooth device off and on before a connection is established.\nIf all else fails, consider reseating the USB adapter, then repeat this script\n"
fi
if echo $activeblueiso > /dev/null; then
    #echo  ---------------------------
    echo "Take note of the status below: "
    echo ---------------------------
    echo "Bluetooth Daemon: Active"
    echo "Nothing to do: Exiting script"
else                       
    echo "Bluetooth Daemon: Inactive. Failed to re-establish connection..."
    echo -------------------------------------------------------------------
    echo "More tests need to be performed. Nothing to do: exiting script now ..."
fi
Filename: None. Size: 3kb. View raw, , hex, or download this file.