Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

case "${i}" in

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


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.