how to disable an RTC alarm in linux (once sheduled)

2

1

RTC alams are working great for waking up my system when I want to record a program, but if I decide that I don't want my system to wake when it is scheduled to, I'm finding it hard to disable that previously scheduled alarm. I've tried:

sudo sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm"

but when I subsequently do:

cat /proc/driver/rtc

The alarm has been changed to 5 minutes in the future.

I've also tried:

sudo sh -c "echo `date '+%s' -d '- 5 minutes'` > /sys/class/rtc/rtc0/wakealarm"

but that also moves the alarm to 5 minutes in the future (instead of the intended 5 mins in the past). For now I just unplug the laptop to disable the wake up, since it will not wake up a laptop on battery power. Any ideas of how to disable the RTC alarm? Thanks.

nomadicME

Posted 2012-09-07T22:34:54.903

Reputation: 153

Answers

3

That is how I expect it to work. Have you tried seeing if it will actually wake up?

This is what it looks like when I turn an alarm on:

$ sudo bash -c "echo $(date +'%s' -d '20 minutes') > /sys/class/rtc/rtc0/wakealarm"
$ cat /proc/driver/rtc 
rtc_time        : 13:25:55
rtc_date        : 2013-01-07
alrm_time       : 19:45:54
alrm_date       : 2013-01-07
alarm_IRQ       : yes          # Alarm is now on
alrm_pending    : no
...

And when I turn it off:

$ sudo bash -c "echo 0 > /sys/class/rtc/rtc0/wakealarm"
$ cat /proc/driver/rtc 
rtc_time        : 13:28:09
rtc_date        : 2013-01-07
alrm_time       : 13:33:07
alrm_date       : 2013-01-07
alarm_IRQ       : no          # Alarm is now off
alrm_pending    : no
...

Izkata

Posted 2012-09-07T22:34:54.903

Reputation: 342