Keep bluetooth from sleeping

andy baxter andy at earthsong.free-online.co.uk
Sun Oct 14 17:34:28 UTC 2007


tsai wrote:
> Hi all,
>  I am trying to make a bash script that does not let my k700i fall 
> asleep, thus disconnecting the bluetooth connection.
>  
>  The script needs to be something like this:
>  #!/bin/sh
>  su
>  password
>  hidd --connect 00:12:EE:47:5A:92
>  exit
>  I don't know the correct syntax.  Any help is greatly appreciated!
>
>  Thanks,
>
> tsai
>
su doesn't allow you to specify a password on the command line 
(deliberately I think, for security reasons)

The right way to do this is to write a short script like:

#!/bin/sh
hidd --connect 00:12:EE:47:5A:92
exit


then save it somewhere (/usr/local/bin is usual) and make a symbolic 
link to it from one of the following directories in /etc/:

cron.daily
cron.hourly
cron.monthly
cron.weekly

depending on how often you want it to run.

If this isn't often enough (maybe not), do some research on 'cron' and 
'crontabs' and you should be able to figure it out. cron is a periodic 
command scheduler which runs commands at specified intervals, as root 
unless you tell it not to.




More information about the ubuntu-users mailing list