Say I set my laptop to wake every morning with rtcwake (e.g. echo $(date +%s 'tomorrow 08:00') > /sys/class/rtc/rtc0/wakealarm
in a cron job or in /etc/pm/sleep.d/99-set-alarm.sh
).
Now, I'd like to run a script from /etc/pm/sleep.d/80-on-rtc-wake.sh
only if the laptop was woken by the RTC alarm. Is it possible to check that the laptop was in fact woken by the RTC alarm?
I know I can read /sys/class/rtc/rtc0/wakealarm
and it will be empty if the alarm is unset or alarm time has passed, but that leads to a race condition since I want to set the alarm for next morning.
Is there log or something that tells explicitly if the wake was caused by an rtc alarm?
0 Answers