Need Help with Simple Script

Questions about applications and software
Forum rules
Before you post please read how to get help

Need Help with Simple Script

Postby garda on Fri Oct 31, 2008 11:01 am

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?
User avatar
garda
Level 5
Level 5
 
Posts: 744
Joined: Sat Aug 30, 2008 2:55 am
Location: /root

Linux Mint is funded by ads and donations.
 

Re: Need Help with Simple Script

Postby SiKing on Sat Nov 01, 2008 2:20 pm

I would imagine it should look something like:
Code: Select all
#!/bin/bash
sudo modprobe bluetooth
sudo modprobe hci_usb
sudo hciconfig hci0 up
sudo /etc/init.d/bluetooth start

Once you have the script, you will want to give it execute permissions with chmod +x <name>.
SiKing
Level 5
Level 5
 
Posts: 576
Joined: Mon Sep 29, 2008 10:57 pm
Location: Las Vegas

Re: Need Help with Simple Script

Postby garda on Mon Nov 03, 2008 11:33 pm

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.
User avatar
garda
Level 5
Level 5
 
Posts: 744
Joined: Sat Aug 30, 2008 2:55 am
Location: /root

Re: Need Help with Simple Script

Postby ronnoc on Tue Nov 04, 2008 1:18 am

I can personally report that with my D-Link DBT-120 Mint KDE CE works flawlessly out of the box with KBluetooth. My CPU is like...nill. I know this doesn't directly help you, but it is always an alternative.

garda wrote: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.
Image
User avatar
ronnoc
Level 3
Level 3
 
Posts: 128
Joined: Sun Sep 21, 2008 12:11 am


Return to Software & Applications

Who is online

Users browsing this forum: tostoday and 17 guests