Shell Wake from suspend at a specific time

I've been looking around for some way to let my FreeBSD server go to sleep/suspend at a specific time and then wake up at a later time. For instance, I'd like my home server to go into suspend mode each evening around 10 PM and wake up around 8 AM since there isn't any reason for it to be on during the night.

On Linux I can do this by writing the time I want the machine to wake to the file /sys/class/rtc/rtc0/wakealarm and then calling the pm-suspend command. Dropping these actions into a cron job worked really well for me and it's just two lines of shell script.

From what I've been able to find, versions of FreeBSD up to 9.x did not offer a wake-from-suspend timer. Has this changed? Is there a program in ports that implements a scheduled wake-from-suspend?
 
I can't offer you a solution, but just a hint so you don't go looking in pointless directions:
Is there a program in ports that implements a scheduled wake-from-suspend?
This is impossible without support from BIOS and kernel. On a suspended machine, you obviously can't run any code. So the only way to get it do what you want here is setting the RTC as a source for ACPI wakeup and setting its alarm time. If the kernel/drivers do not support this, you are out of luck. According to https://www.freebsd.org/projects/acpi/, such functionality is "low priority" and not done.

If you're very lucky, you can configure RTC wake through your BIOS and not have the OS change this, then all you'd have to do is getting the machine to suspend from cron -- which should be easy.
 
The timed suspend/shutdown is easy enough to do. As I mentioned above I already have an installation of Ubuntu doing just that and then it automatically wakes from suspend. Putting the machine to sleep with FreeBSD is also easy, the hard part (I'm finding) is getting it to wake up again.

As for having the BIOS boot the system, I don't believe this machine has that functionality. I'm looking for something that'll work on a kernel level.
 
Back
Top