Skip to content

Instantly share code, notes, and snippets.

@devtronic
Created November 25, 2018 10:46
Show Gist options
  • Save devtronic/bb65094acdbe74b704327e83b233d12a to your computer and use it in GitHub Desktop.
Save devtronic/bb65094acdbe74b704327e83b233d12a to your computer and use it in GitHub Desktop.
Automatic update check for ubuntu server with mail notification
#!/bin/bash
apt update
upgradeable_count=$(($( apt list --upgradeable | wc -l) - 1))
if [ $upgradeable_count -gt 0 ]; then
apt list --upgradeable | mailx -s "$upgradeable_count Updates available at $(hostname)" [email protected]
fi;
@devtronic
Copy link
Author

  1. Einfach [email protected] durch deine E-Mail-Adresse ändern
  2. Auf deinem Server ablegen und mit chmod 775 check-updates.sh ausführbar machen.
  3. Mit crontab -e ein eintsprechender crontab Eintrag erzeugen (https://crontab-generator.org/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment