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.

  • 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..) May 11, 2010 at 15:52

2 Answers 2


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.


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.

  • Well, yes. But a wake up from sleep is not the same as a reboot.
    – Shi
    Jun 9, 2014 at 23:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .