How to schedule power on and power off?

Hi all,
I’ve a question.
I’ve a Suse installation on a small file server I use in my home for personal use.
As I’m not always at home and I don’t use this server every day/every time, I’d like to save a bit of power consumption turning it off during some night hours and some day hours when anyone at home use it.

So, my question is if there is a way to schedule the turning ON/OFF cycles, or, at least, if there is a way to turn off the server after XX minutes and turning it on when someone try to connect to it.

Thanks in advance.

For turning off after so many minutes of “doing nothing”. you must fisrt define what “doing nothing” is. I e.g. I have a desktop system here that also is an NFS server for another desktop system. My check is: anybody loged in ( who | wc -l ) and is the other system down ( ping ). I make a not of this in /tmp. Second time the result is the same (no users loged in, other system down), I remove the note and shutdown, When not remove the note. So two consecitive OKs are needed. This is run from the crontab of root from 23.00 - 7.00 every 5 mins. I hope you understand this is just an example on which you must variate wildly.

For switching on, you need WOL (Wake on LAN). Your NIC must support it, the hardware of the system must support it, it must be switched on (with ethtools). When this all can be done in your case, the system will boot when another system on the LAN tries to contact it. But that takes time, so it is still possible that the other system times out on the action wanted.:frowning:

I imagine that there isn’t any graphic tool to make your double check, right?

For the switching on using LAN, I’ll check my hardware… I think that it should support it but I’m not sure.

In any case, thank you for the suggestions.

To begin with I guess that your requirements about what defines the system to be idle vary wildly from my example. And the possibilities and how to test on them are also manifold. So that is clearly something that should be scripted (and a lot of testing I guess). IMHO not realy something that is just a case of a few configuration items in a file (oh yes, I want that and I do not think I require X) that then can be edited with a dedicated GUI program.

You can schedule On/Off cycles with a BIOS settings.

Not if power to the BIOS processor has been switched off. Providing the mainboard and network circuits have power then the computer can be reawakened via a network request, as has been mentioned.

escribed, WOL is a common way to activate a machine from another machine, and depending largely on whether you’re installed on an SSD or HDD and what services need to be started on boot, it can take anywhere from a minute to several minutes before your machine will be responsive.

Another approach is to power down all the components and peripherals that consume the most energy… hard drives and the display until they are needed, Drives can be spun back up within a minute and displays can be switched on instantly manually (Be aware that blanking a screen doesn’t power down your display but if your display is not ancient it itself may be “Energy Star” enabled and have a “sleep” mode). Your hard drives can be powered down with a power savings plan which is most commonly provided by the Desktop you’re running (but can also be managed by command line.

Otherwise, the CPU and RAM plus optionally your fan consumes very little power.


That is all nice talking of if … and if … and if …, but as long as the OP can not precisely define what he thinks is the technical definition of his system doing nothing, nobody can even start to help him with writing the statements that must check the several conitions wanted.

Why not just suspend to RAM your machine? If you want automatic shutdown/wakeup you must not completely shut down it anyway.

In other words, for automatic wakeup it still needs to be powered. **systemctl suspend **is the command for suspending your machine with a reasonably current SUSE release.

For automatic wakeup I guess you need some network mechanism, a signal that your router or someone can send to your sleeping machine. Maybe the BIOS can also wakeup a suspended machine.

And Suspend to RAM has the advantage, that your machine can wakeup in seconds and does not boot first. Unless you have a 10+ year old rig, suspending should work fine. I think.

To answer the basic question "How do you schedule a power on and power off, without all the bells and whistles resulting from the original questioner’s context:

To power the system on at a given time, you need to rely on the BIOS. Mine at least has a setting for this.
(That’s because once the system is actually shut down, there is nothing that Linux can do to start it.
MacOS users may find this frustrating: MacOS can set it from the GUI, since Apple controls the hardware and hence the BIOS. For a PC architecture that is not the case.)

To shut the system down at a given time, I would configure an entry in root’s crontab that invokes the command “shutdown +10”, which will shut the system down ten minutes after the time that is set in crontab.

Why posting an answer to such an old thread where nobody is subscribed anymore?

This is closed.