Re: apt-get automated
On Wed, Dec 11, 2002 at 03:29:08PM +0100, Niclas Söderlund wrote:
> Hiya folks,
>
> any tips on how to have apt-get every evening at a fixed time via cron, do
> an update (easy) and then a simulated upgrade/dist-upgrade and then mail it
> to root?
>
> I.e I want something telling me its time to do an upgrade of some packages,
> but dont want it to be run automatically (dangerous, and sometimes .conf
> files is changed and needs see to on site). I ONLY want the mail if there
> ARE any upgrades waiting, otherwise not.
>
> Any tips appreciated.
short and ugly:
---cut---
#!/bin/bash
x=$(apt-get -s upgrade|grep upgraded|awk '{print $1}')
if [ "$x" -ne "0" ]
then
echo "Need some upgrades"
fi
---cut---
If you like you can replace the echo blah with
apt-get -s|mail -s "Need upgrades" my@e-mail.address.com
HTH
Sven
--
sig wurde betriebsbedingt gekuendigt
Apt-rpm packages for RedHat:
http://www.hoaxter.de/aptrpm/index.html
Reply to: