run command automatically right after wake up from standby ("sleep")?

5

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.

cknoll

Posted 2010-05-11T15:39:01.203

Reputation: 341

1hooking 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 – 2010-05-11T15:52:31.690

Answers

1

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.

Gordon

Posted 2010-05-11T15:39:01.203

Reputation: 161

0

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.

bZezzz

Posted 2010-05-11T15:39:01.203

Reputation: 696

Well, yes. But a wake up from sleep is not the same as a reboot. – Shi – 2014-06-09T23:17:40.120