Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] How run a script on wake up?

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

[Solved] How run a script on wake up?

#1 Post by bester69 »

Hi,

I need some help, I took a look at internet seeking for this, but I didnt find much very good information about it, I tried some proposals solutions but they didnt work at all, so I came here for some help of you, I know this mustn't be any difficult, so where and How do I have to go about setting thoses scripts in order to be launching on waking up or/and on suspending the system.


Thanks a lot.
Last edited by bester69 on 2019-01-12 23:54, edited 1 time in total.
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: How run a script on wake up?

#2 Post by bw123 »

Ways I can think of off the top of my head..
/lib/systemd/system-sleep - check man systemd-sleep
/usr/lib/pm-utils/sleep.d or /etc/pm - might or might not need pm-utils pkg
/etc/acpi - catch a lid or power event, probably some examples there already
use laptop-mode or some other power mgr, not too difficult.

If you post the script, or describe it, there might be a reason to use one or the other or none of the above.
resigned by AI ChatGPT

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: How run a script on wake up?

#3 Post by Head_on_a_Stick »

bester69 wrote:I tried some proposals solutions but they didnt work at all
If you state explicitly what you have already tried then it will stop people wasting your time by posting suggestions you have already attempted.

And without posting your exact method we have no way of knowing if you're doing it right.

Take a look at an example unit file I posted over at the ArchLabs forums, that runs when resuming from suspend or hibernate:

https://forum.archlabslinux.com/t/how-t ... ed/2065/45

^ The key is the WantedBy line ;)
deadbang

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: How run a script on wake up?

#4 Post by bester69 »

Ok, I found out the problem is, I was using pm-suspend for suspending system, so It cant trigger thes scripts by using pm-suspend.

The Solution was using systemctl suspend
.:
>> systemctl suspend

Code: Select all

sudo tee /lib/systemd/system-sleep/wakeup_script <<'EOB'
#!/bin/sh
case $1 in
    post)
        #COMMANDS GO HERE
        ;;
esac
EOB
Thanks for your help.
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

Post Reply