Wake-up Notification from sleep

Hi Robert,

I tried several ways to get a notification from sleep wake-up. Not working.

  1. hdparam seems not called
    image

  2. all scripts under sleep.d are not called:

image

How to create a script to be called when O/S wakes up?

Thank You,
David

Hi @dzhou , since we are running systemd by defualt, take a look at this guide:

https://wiki.archlinux.org/index.php/Power_management#Hooks_in_.2Fusr.2Flib.2Fsystemd.2Fsystem-sleep

Regards,

Hi Robert,
I created a service, and set After=suspend.target ( see image)
image

It is enabled and tested by itself.
But it is not hooked to resume from sleep ( for example: rtcwake -d /dev/rtc0 -m standby -s 3 )
I tried sleep.target, too. And I created a script in /usr/lib/pm-utils/sleep.d and it is not called.

sleep.target, suspend.target, hibernate.target or hybrid-sleep.target to hook units into the sleep state logic instead of using custom scripts

I don’t know resuming from standby mode is corresponded to which target?
Best Regards,
David

Hi Robert,

I have tried several ways, but none of them runs a script if O/S wakes up from standby. Please help me with a working example if you have.

Best Regards,
David Zhou

Hi Robert,
I go a solution: Using systemctl suspend to put BBB into sleep. And in the /etc/systemd/sleep add:
SuspendState=standby,
When it wakes up, it calls the script.

Best Regards,
David