Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Check and email debian updates
#!/bin/bash
mailto="email@example.com"
# Download only; package files are only retrieved, not
# unpacked or installed.
apt-get -dqq update
apt-get -dyqq upgrade
has_upgrades=$(apt-get -s upgrade | grep ^Inst)
if [ "$has_upgrades" ] ; then
echo "$has_upgrades" | mail -s \
"Updates for MyCoolServer - $(hostname) on $(date +%Y-%m-%d)" \
$mailto
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.