I'm trying to automatize the updates of debian system, without making upgrades. Then i'll send an e-mail to me, everytime there is an upgrade available.
I've tryied to do it with cron-apt, but i really don't like how the configuration is organized, that's why i would prefer using a (cleaner) cron job that launch the script.
looking around i found that piece of code (not mein) :
if [[ `apt-get update 2>&1 | grep Get` ]]; then if [[ `apt-get --simulate dist-upgrade 2>&1 | grep Inst` ]]; then apt-get --simulate dist-upgrade fi fi
From what i can understand, that script update the local packages list, and make a simulation of an eventual upgrade.
Now if it's possible i would like to send to me via email the output of the update, and of the upgrade-simulation. For acheave that i could use mail command:
sending first email:
apt-get update | mail -s "daily update report" firstname.lastname@example.org
apt-get --simulate dist-upgrade | mail -s "daily upgrade-simulation report" email@example.com
My main question is if there a better approach to do all this..?
Secondarely, I've tryied without succed to send everything in just one email, anybody know how i could do it?