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 :-)

 

原文链接:http://tlug.dnho.net/node/213 

相关文章:

  • 2022-01-13
  • 2022-12-23
  • 2021-08-22
  • 2021-06-26
  • 2021-11-29
  • 2021-06-21
  • 2022-12-23
猜你喜欢
  • 2021-09-20
  • 2022-12-23
  • 2021-07-25
  • 2021-12-14
  • 2022-12-23
  • 2021-10-30
  • 2021-08-29
相关资源
相似解决方案