Hi,
I need to write a script which, when executed, invokes the following commands in consecutive fashion to activate Bluetooth:
- (sudo) modprobe bluetooth
- (sudo) modprobe hci_usb
- (sudo) hciconfig hci0 up
- (sudo) /etc/init.d/bluetooth start
Also another one to deactivate Bluetooth and unload the modules:
- (sudo) /etc/init.d/bluetooth stop
- (sudo) hciconfig hci0 down
- (sudo) modprobe -r hci_usb bluetooth
Can anyone show me what the script should be like?
Need Help with Simple Script
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Need Help with Simple Script
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Need Help with Simple Script
I would imagine it should look something like:
Once you have the script, you will want to give it execute permissions with chmod +x <name>.
Code: Select all
#!/bin/bash
sudo modprobe bluetooth
sudo modprobe hci_usb
sudo hciconfig hci0 up
sudo /etc/init.d/bluetooth start
Re: Need Help with Simple Script
Thanks for the hint.
Your script works just fine except it can't be triggered through a desktop shortcut. I need Bluetooth be easily accessible on a shared computer at home since some people here use it sometimes but I can't afford to have the module loaded everytime as it causes processor utilization to soar by around 25% (sometimes even more). Hence, I'm in need of a way to toggle it without having to touch terminal because these users here don't see it convenient. If you, or anyone else, know how to achieve what I'm after , please let me know some more.
Your script works just fine except it can't be triggered through a desktop shortcut. I need Bluetooth be easily accessible on a shared computer at home since some people here use it sometimes but I can't afford to have the module loaded everytime as it causes processor utilization to soar by around 25% (sometimes even more). Hence, I'm in need of a way to toggle it without having to touch terminal because these users here don't see it convenient. If you, or anyone else, know how to achieve what I'm after , please let me know some more.