In the event of periodic, but rather short-term, power outages and the presence of an inexpensive UPS with 1-2 7 Ah batteries, it does not always make sense to turn off the computer until the light is on. Especially if you find it long and difficult to raise the work environment. Below you will find measurements of power consumption for a specific desktop and a strategy for working with a UPS with unstable electricity.
If very roughly, Linux has two types of "hibernation" - hibernate, when the state of memory is flushed to disk and is read from there when the OS starts, and the second suspend - power is supplied to the RAM strips, but hard disks, fans, including ... power supply. Hibernate, in my opinion, is of little relevance, with the current amount of memory, the need for additional configuration, the likelihood of the UPS battery being drained during the transition to it. From the pros - if you have time to switch to hibernate, then the battery discharge to zero is not terrible for you.
But you should remember (thanks ZlobniyShurik per addition) suspend mode also has disadvantages:
1. The most obvious thing is that sometimes, instead of short-term voltage dips, there are power outages for several hours. In this case, suspend will become a death trap for data. Before leaving for suspend, save everything you can.
2. Many inexpensive uninterruptible power supplies are fundamentally not designed for long battery life, even with a small load (overheating of the boost converter due to poorly designed cooling and low efficiency). Moreover, some of them simply forcibly extinguish the electronics after N minutes of battery life.
3. He can also put a pig on Green mode (by the way, it can not be turned off at some of the UPS). Your computer goes into hibernation, reduces consumption to 30-25-20 watts, the UPS understands that nothing but some unnecessary trifle is included in it and begins to save energy by turning it off completely
However, Suspend allows you to get in and out of it fairly quickly without additional configuration. Just by the command "sudo systemctl suspend". What about power consumption?
So, the configuration in idle mode consumes electricity:
- 2 monitors
- AMD FX-6300 processor + some kind of motherboard
- 4 RAM strips
- 2 TB HDD 7200
- DVD-ROM
- external HDD via USB3
- mouse, keyboard, webcam
All this consumes 160 watts. With the monitors off - 118 watts. After pressing "systemctl suspend" (the computer puts the monitors into standby mode) - 25 watts. If you turn off the monitors also physically - 23.5 watts.
Thus, putting the computer into suspend mode will allow you to increase the operating time from the UPS by 5-6 times. Which can be enough if you have a rough idea of ββthe frequency and duration of blackouts in your area. I do not give specific figures for the operating time, because it strongly depends on the condition of the batteries in the UPS, which need to be changed (in my experience) at least once every 2 years, and frank Chineseism is better once a year.
And since this is Linux, there are some nuances. When using docker, which likes to change the routing table, there may be some networking issues. To avoid this, it is better to use the following script to go to suspend (which can be run as root):
#!/bin/bash
#
systemctl suspend
#
systemctl stop docker
#
ifconfig <> down
dhclient <>
# openvpn/wireguard
killall openvpn && cd /etc/openvpn && openvpn client.ovpn
# docker
systemctl start docker