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.

I am using an HP netbook with a Broadcom wl-card. I use the STA driver. After waking up from sleep it takes normally 30 seconds to be reconnected to my WLAN. Using the command sudo iwlist scanning the reconnection process starts immediately. I wrote a script echo $Password | sudo -S $iwlist scanning and start it via a starter from the desktop, thus reducing the time to 15 sec. Is there a way to start the script automatically and preventing the terminal from popping up.

share|improve this question

1 Answer 1

First, have a look at how your computer suspends/resumes. According to that you might adapt your script and put it into /etc/pm/sleep.d. The script should look like

#!/bin/sh
case "${i}" in
  resume)
  $DO_SOMETHING
  ;;
esac

A second (and better) possibility is to modify /usr/lib/pm-utils/sleep.d. There are some scripts, important are 55NetworkManager and 60_wpa_supplicant. The numbers 55 and 60 are a kind of priority. The lower the number the earlier the suspend script is executed. At resume the scripts are run in reverse order.

So I would suggest copying the scripts from /usr/lib/pm-utils/sleep.d to /etc/pm/sleep.d/ and play around with the first number. Maybe there are some dependencies on your system. You will have to find out through some experimenting.

share|improve this answer

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.