By akademiotoelektronik, 12/06/2022

Linuxfr.org Connect journal Turn off your server at night and turn it on automatically in the morning last comments (tags) popular sites friends about Linuxfr.org

A classic situation

Imagine a physical machine under Linux hosting usual services (file sharing, VPN, etc.) used by a small business/community.In order to save energy, this server should be on in the morning and extinguished in the evening, automatically.After all, we have to divide our CO2 production by two by 2030, it will not be done on its own.

The server is a classic Dell Poweredge T110 II, which can be found used.With three discs 3.5 ", he consumes between 32 and 55 W according to my measurements. Extinct between midnight and 7 a.m., we save between 81 and 140 kWh per year. It's not much but it's already that.

Unfortunately, the BIOS does not allow you to program an automatic ignition.

We can still

LinuxFr.org Se connecter Journal Éteindre son serveur la nuit et l'allumer automatiquement le matin Derniers commentaires Étiquettes (tags) populaires Sites amis À propos de LinuxFr.org

If I understand correctly, the machines which implement ACPI (Advanced Configuration and Power Interface) and which have a battery (to keep the time), can be programmed from the operating system to start automatically at a given hour: C'is acpi wakeup.Great !

Sous Linux on y accède par le pseudo-fichier /sys/class/rtc/rtc0/wakealarm. C'est très basique, puisqu'on ne peut y lire/écrire que le prochain démarrage prévu, sous forme du nombre de secondes depuis epoch.

We want the script!

Yes, we are therefore obliged to make a script which, every day, program the next start.Like all that relates to time management, we quickly make nodes in the brain.It is to avoid this that I put my script and the explanations on Framagit.I also invite you to consult the wiki of mythtv which talks about this more detail feature.

Tags: