I want raspi to (1) bootup, (2) do a task, (3) go into suspend mode for x amount of time, (4) wake up and do it all over again.
1 and 2 are easy: sudo crontab -e
, which has just one line: @reboot /home/pi/boottasks.sh
boottasks.sh contains (and is made executable with chmod a+x boottasks.sh
):
#!/bin/bash
echo 'pi woke at ' ($date) >> boottasks.log
some_other_task
So far, I found out I can force reboot with sudo shutdown -r
, and I can force hibernate with sudo shutdown -hP now
The problem is that raspi doesn't seem to obey what's in the crontab. That is, this line in the crontab: */30 * * * * sudo shutdown -r
will not work if the last task list in boottasks.sh is sudo shutdown -hP now
. In fact, that last bit is a good recipe for an endless loop that has pi rebooting all the time.
I can't believe what I want isnt't possible. I've seen the (somewhat straying discussion) here. Didn't answer my question.
And this, using rtcwake -m mem -s 180
, runs into
rtcwake: open failed: /sys/class/rtc/rtc0/device/power/wakeup: No such file or directory
rtcwake: /dev/rtc0 not enabled for wakeup events
I'm new to Linux. But seasoned with computers. Any hints in the right direction would be much appreciated.