Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

There is a bug in Ubuntu that prevents bluetoothd from starting when the computers wakes up from hibernate. So far there is no solution. I am fed upstarting bluetoothd manually every time, I think a possible workaround may be to automatically do the following on waking up:

  1. Check if bluetoothd is running.
  2. If it is not running, start it.

I would appreciate if someone could give me an advice on how to implement that. Which startup script executes when Ubuntu wakes up from hibernate? How to check if the daemon is running?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You should drop the file in /etc/pm/sleep.d . All the scripts in this dir are executed when a power manage event happens. You can check the first parameter to know what event has invoked the script.

There is a nice example in this answer

share|improve this answer

If you get a login screen when your computer wakes-up, a simple solution will be to add service bluetooth start to your ~/.profile because GNOME will execute commands in this file when you login. If you dont use GNOME or if you dont get a login screen then you can add a file to /etc/pm/sleep.d with followiing lines in it

#!/bin/sh

case "$1" in
    thaw)
        service bluetooth start        
        ;;  
esac

this will script will start bluetooth service i.e bluetoothd whenever your system comes back from sleep/hibernation

share|improve this answer
    
It's not possible to start a system service as a normal user (well, not without special sudo permissions). –  JanC Dec 13 '10 at 13:32
    
Yes but the scripts in /etc/pm/sleep.d get executed with root permissions. –  binW Dec 13 '10 at 14:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.