Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I run a command automatically every time my systems wakes up from standby ("sleep")? I am using Kubuntu. (still 9.10 but I'll migrate soon to 10.4)

As the window manger is locked right after wake up it would suffice if the command is executed every time after unlocking the screen.

share|improve this question
1  
hooking into wake-from-standby and hooking into unlock-screen are very different things. also, this is very likely something that will have changed between 9.10 and 10.04 -- if you're definitely migrating soon, look for 10.04 solutions. (at least, this is true in the Ubuntu/Gnome world. maybe Ubuntu/KDE is saner, but i doubt it..) –  quack quixote May 11 '10 at 15:52

2 Answers 2

Run a system command automatically at Startup

Sometimes it can be useful to add a custom command to the startup process so that your computer executes it on every boot. To do this:

Edit the crontab with administrative privileges (see the section called "Root And Sudo"):

sudo crontab -e Insert the following line:

@reboot /home/user/command

From Kubuntu Guide.

share|improve this answer
    
Well, yes. But a wake up from sleep is not the same as a reboot. –  Shi Jun 9 at 23:17

Using ACPI, you can configure scripts to run as certain events are triggered by the laptop. I used to run a script to reload errant network drivers after a restored from sleep. No idea if you have ACPI on your machine, or if you are using acpid, but thought I'd throw the suggestion out there.

Triggering off of a screen unlock is an entirely different thing and ACPI wouldn't apply there.

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.