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

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" [email protected]

second email:

apt-get --simulate dist-upgrade | mail -s "daily upgrade-simulation report" [email protected]

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?


1 Answer 1


Don't reinvent the wheel.

apt-get install apticron

Apticron is a simple script which sends daily emails about pending package updates such as security updates, properly handling packages on hold both by dselect and aptitude.

  • thankyou for the answer! i didn't knew that package. I installed it and trying to configure the time when it checks and send email notification
    – lese
    Commented Apr 17, 2014 at 8:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .