On 2020-12-24, Gabriel Hondet <gabriel.hon...@laposte.net> wrote: > On Thu, Dec 24, 2020 at 08:16:12AM -0800, Bryan Linton wrote: >> On 2020-12-24 10:31:22, Ian Darwin <i...@darwinsys.com> wrote: >> > On Thu, Dec 24, 2020 at 11:51:26AM +0100, Gabriel Hondet wrote: >> > > Hi, >> > > >> > > How can I program my computer to automatically wake from suspend to ram >> > > or suspend to disk at a certain time? >> > > >> > > My goal is to suspend a server every day from, say, 11 pm to 7am. >> > >> > For suspending at night, use see the cron man page. >> > >> > For waking up in the morning, of course, the OS isn't running so there is >> > nothing >> > it can do. > In fact I was hoping that it can, since for instance it can be woken up > by pressing a key (although I don't know anything about the mechanics > involved). For this I thought the line > > acpi0: wakeup devices LID_(S4) SLPB(S3) IGBE(S4) EXP2(S4) XHCI(S3) > EHC1(S3) > > of dmesg could help. It seems, if I'm not mistaken, that Linux supports > such a thing using rtcwake.
It does, at least on some machines. Nobody has implemented an equivalent for OpenBSD yet afaik. There are various complications, https://www.mythtv.org/wiki/ACPI_Wakeup talks about it a bit. >> > Some but not all PC BIOSes have a scheduling feature. > Ah that's interesting thank you. Yes, this is probably simplest if available. >> > Otherwise a >> > $10 mechanical timer to cut the power (well after the suspend is >> > finished!) and >> > turn it back on in the morning. >> > >> >> If shutting down the server entirely (instead of suspending it) >> were an option, you could schedule a cron job to shut it down at a >> given time and send a WoL (Wake on LAN) packet from another >> computer on the network to wake it up again. >> >> Oh, I just skimmed the ifconfig manpage and found the following: >> >> wol Enable Wake on LAN (WoL). When enabled, reception of a >> WoL frame will cause the network card to power up the >> system from standby or suspend mode. WoL frames are sent >> using arp(8). >> >> So it looks like you could even do this while the system were >> suspended if your network card supports it. Of course, this >> depends on having another server on the same, physical LAN as the >> server in question, so the mechanical switch suggestion above might be >> the only option if that's not the case. > That's a good idea as well, thank you. It is particularly widely supported in NIC drivers on OpenBSD. The following can do wol: re xl jme nfe vr rge. In particular it's not supported with any of the intel NIC drivers.