back to scripts

run-tonight-updates.sh

bash 15 lines secrets redacted

Scheduled overnight runner that sequences the OS and image updates in a safe window.

Note Live script from my home-lab server. Tokens, IDs, phone numbers and other secrets have been replaced with placeholders like <WHATSAPP_GROUP_ID> — everything else is the real, running code.
#!/bin/bash
set -o pipefail
export HOME=/home/lanky
LOG="$HOME/docker/tonight-updates-$(date +%Y%m%d-%H%M%S).log"
{
  echo "=== Scheduled update started: $(date -Is) ==="
  /home/lanky/scripts/update-os.sh
  if [ "$(id -un)" = "lanky" ]; then
    /home/lanky/scripts/update-all.sh
  else
    sudo -u lanky HOME=/home/lanky /home/lanky/scripts/update-all.sh
  fi
  echo "=== Scheduled update finished: $(date -Is) ==="
} >> "$LOG" 2>&1
chown lanky:lanky "$LOG" 2>/dev/null || true

back to scripts