Hello,
This script will do a bunch of things - it's main purpose is to help keep apt based systems up to date. Check out the top part of ths script for a more in depth explanation.
Run this script periodically via cron.
NOTE: This script has been tested on Debian (Sarge) and Ubuntu (5.10), your mileage may vary on other systems using apt.
fi
stoplogging
exit 0
An email detailing required updates looks like this:
Subject:[server.example.com] server may need some updates applied
Hello,
Packages have been downloaded onto server.example.com.
The following packages will be upgraded:
exim4 (4.50-8 => 4.50-8sarge2)
exim4-base (4.50-8 => 4.50-8sarge2)
exim4-config (4.50-8 => 4.50-8sarge2)
exim4-daemon-light (4.50-8 => 4.50-8sarge2)
libc6 (2.3.2.ds1-22 => 2.3.2.ds1-22sarge3)
libc6-dev (2.3.2.ds1-22 => 2.3.2.ds1-22sarge3)
libsasl2 (2.1.19-1.5 => 2.1.19-1.5sarge1)
locales (2.3.2.ds1-22 => 2.3.2.ds1-22sarge3)
mutt (1.5.9-2 => 1.5.9-2sarge1)
perl (5.8.4-8sarge3 => 5.8.4-8sarge4)
perl-base (5.8.4-8sarge3 => 5.8.4-8sarge4)
perl-modules (5.8.4-8sarge3 => 5.8.4-8sarge4)
tar (1.14-2.1 => 1.14-2.2)
13 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
The server has the following network interfaces configured eth0 192.168.10.1 eth1 192.168.1.220.
To update the server log in via ssh (e.g. ssh root@192.168.10.1) and run the following command:
apt-get upgrade
See the logfile for more info: vim /var/log/server_maint.log
Regards.
Here is a sample of the log output:
=================================================================================
./maint.sh started running at Wed May 17 15:13:40 JST 2006
=================================================================================
Wed May 17 15:13:40 JST 2006 [SUCCESS] apt-get clean ran without error
Wed May 17 15:13:40 JST 2006 [SUCCESS] apt-get update ran without error
Wed May 17 15:13:41 JST 2006 [SUCCESS] apt-get -yqd upgrade ran without error
Wed May 17 15:13:41 JST 2006 [MESSAGE] No packages need updating.
Wed May 17 15:13:41 JST 2006 [MESSAGE] ./maint.sh finished runnning
---------------------------------------------------------------------------------
Please posts any fixes/suggestions here. In particular how to rewrite this without needing perl :-)