In my earlier setup i had a lot of small servers running different processes. These servers were turned on at differnet times of the day when needed. To this I used different rtcwake setups. My MythTV backend server is turned off every night at 02:00 and turned on again at 14:00 by rtcwake. The goal was to save on the electricity bill. The same can be done with a nas like OMV. You can turn off your nas every night and turn it on at a specific time every morning.
The rtcwake command is
Rtcwake depends on your motherboard acpi support. Rtcwake can use four different modes of sleep/off – these are selected by the ”-m” parameter:
- standby - which offers the least power save
- mem – suspending to ram – saves some more power than standby
- suspend - to disk and turns of the unit - saves more power than mem
- off – which is turning the unit completely off - saves the the most power
First you must test the capability of acpi that your mobo/bios supports. Test the different modes of sleep by giving a rtcwake command with each of the sleeping modes. If the board is not going to the requested sleep/off mode or not waking up - that mode isn't supported by your mobo in its current setup. You options are to either use another sleep/off mode or to enter bios setup and chacek that your acpi and sleep mode options are turned on. Check you'r mobo documentation.
Everything here needs root priviledges so do your ”sudo -i” or what ever your setup needs to give roots rights.
Lets put the unit to sleep with the different modes and test if it wakes up as expected:
with root priv type:
This should turn of your machine in an orderly manner and set the bios to wake it up 5 minutes later. I use -s 300 because the most nas's needs some time to umount disks and stop all processes before turning off. If you'r setup turns off faster you can shorten the -s parameter. Just make shure the unit is able to turn completely off before the wakeup time is reached.
If you mobo isn't turning on after 5 minutes your acpi doesn't support the "off" state and you must try one of the other states. Anyhow the ”off” mode is not an official part of the acpi standard. I have several small boxes that doesn't support the ”off” mode.
Test the other modes in the same manner till you find the mode that works and gives the lowest power consumption. My small Fit-pc2 supports only ”mem” mode but this even saves 90% energy compared to a normal on state.
When you have found the sleep/off state you can build your rtcwake command. If you want to turn off your unit at a specific time say 01:00 and turn it on the next morning at 08:00 (7 hours of sleep) the command looks like this:
if you put this in a cron job that runs a 01:00 every night your unit will wake up every morning at 08:00
If you wan't to turn the unit on at a specific time but not turn it off by your rtcwake command you can use this command:
The ”-m no” means that no suspend will be done by rtcwake so you must suspend using an other command or manually.
You can put this command in a scrip that will turn off your nas at a specific condition or what ever you prefer.
If you put this job in cron you will have to be sure that the unit is on at the time the cron job is running. If the unit is turning on after the cron jo should have run your nas will not turn automatically on for before 08:00 the day after.
You can save yourself a lot of troubles with rtcwake if you have your bios set to UTC time and your tzdata setup to reflect your timezone.
Read more about rtcwake on the man pages http://linux.die.net/man/8/rtcwake