Skip to content

Instantly share code, notes, and snippets.

View initiateit's full-sized avatar

Jason King initiateit

View GitHub Profile
@initiateit
initiateit / ubuntu_update_checker.sh
Created November 13, 2022 00:50
A simple Bash script to check for Ubuntu updates and email them to you. I like to use this in combination with Ubuntu's Unattended Upgrades so that security updates are installed automatically and I schedule this script with a cron job every 6 hours. This gives me a chance to at least read up on application updates to see if something is going t…
#!/bin/bash
# Add your email addresses here
from_addr="{from_email}"
to_addr="{to_address"
hostname=$(hostname -f)
UP="All packages are up to date."
PKG_CNT=$(sudo apt update 2>/dev/null | grep packages | sed -n '$p' | cut -d '.' -f 1 | xargs -I "%" echo %.)