summaryrefslogtreecommitdiff
path: root/mail_apt_upgradable.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mail_apt_upgradable.sh')
-rwxr-xr-xmail_apt_upgradable.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/mail_apt_upgradable.sh b/mail_apt_upgradable.sh
new file mode 100755
index 0000000..491addc
--- /dev/null
+++ b/mail_apt_upgradable.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# make sure sendmail works fine, E.g. ssmtp is very light and easy.
+# crontab -e & add the following line to run every 6 hours:
+# 0 */6 * * * /home/miguel/bin/mail_apt_upgradable.sh
+
+SUBJECT="$HOSTNAME : apt list --upgradeable"
+MAIL="m.i@gmx.at"
+
+if [ "$#" -ne 1 ]; then
+ "$0" arg0 | sudo sendmail $MAIL
+ exit
+fi
+
+echo "Subject: $SUBJECT"
+echo "Hello Friend,"
+echo
+echo "This is the automatic apt checker service."
+echo
+sudo apt-get update 1> /dev/null
+echo "'apt update' exited with the return code: $?"
+echo
+echo "'apt list --upgradable -a' produced the following output:"
+echo
+echo "--- START ---"
+apt list --upgradable -a 2>/dev/null
+echo "--- END ---"
+echo
+echo "Best regards,"
+echo "Your FoolBot"