levr/content/posts/un-peu-de-sobriete-energetique.en.md
2025-11-03 09:59:17 +01:00

1.6 KiB
Raw Blame History

+++ date = '2025-11-03T09:31:57+01:00' draft = false tags = [ "homelab" ] title = 'A little energy-conciousness' +++

I like when things take care of themselves.
But before you can automate backups, the machine to be backed up has to be awake.
Pennsardin — my big desktop tower running a RAID 5 array — has an annoying tendency to sleep deeply.

Instead of leaving it powered on 24/7 just “for convenience,” I chose energy sobriety.
My main server stays on, but the others only wake up when they actually have work to do —
in this case, during nightly backups.

A short Bash script, a bit of patience, and the process flows naturally.

#!/usr/bin/env bash

MAC="00:52:54:46:58:34"
echo "[+] Waking up Pennsardin via Wake-on-LAN"
wakeonlan ${MAC}

echo "[+] Waiting for Pennsardin to respond"
until ping -c1 192.168.0.12 &>/dev/null; do
  sleep 1
  printf "."
done
echo -e "\n[+] Pennsardin is online"

echo "[+] Connecting to lomig@pennsardin ..."
exec ssh lomig@192.168.0.12

Heres the idea:

  1. A Wake-on-LAN packet brings the system out of its nap.
  2. A simple loop waits for the first ping reply — making sure the machine is really awake.
  3. Finally, an SSH connection triggers the backup sequence.

This little ritual sums up my homelab philosophy perfectly: automate without wasting. You dont need an always-on cluster to handle a few backups and a blog — just a bit of organization, restraint, and common sense.

Next step? Scheduling this wake-up via systemd, and letting Pennsardin go back to sleep once the backup is done. A digital butler — punctual and energy-conscious.