Skip to main content
deleted 22 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 237

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(im a little-bit noob), 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?

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(im a little-bit noob), 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?

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" [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?

Post Migrated Here from serverfault.com (revisions)
Source Link
lese
  • 2.8k
  • 5
  • 23
  • 32

automate updates with a bash script and cron

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(im a little-bit noob), 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?