cron scripts for maintenance

Andrew Bacchi bacchi at rpi.edu
Fri May 18 13:26:28 UTC 2007


Anne,

I use a perl script to mail a portion of the log file to me, in this 
case the last 60 lines of data.  You'll need to alter the log name, 
recipient, and the number of lines to send.  You will also need to 
install the perl module Mail:Mailer.

#!/usr/bin/perl -w

use strict;
use Mail::Mailer;
use Sys::Hostname;

my $logfile = "/var/log/dsmsched.log";
my $body = `tail -60 $logfile`;
my $host = hostname();

mailit();
exit 0;


sub mailit {
   my $type = 'sendmail';
   my $mailprog = Mail::Mailer->new($type);
   # mail headers to use in the message
   my %headers = (
      'To' => 'someone at somedomain.edu',
      'Subject' => "$host DB Backup Log"
   );
   $mailprog->open(\%headers);
   print $mailprog $body;
   $mailprog->close;
   }	#end mailit()


Anne wrote:
> HI All
>  
> I'm used to running FreeBSD which comes with it's own massive maintenance
> scripts which are setup to email all information (via cron) automatically
> daily. It's incredibly helpful and helps me manage 20 servers with ease.
>  
> My problem now is that I manage another 30 Red Hat 4 servers but it does not
> come with any of those very helpful scripts, and the system that emails the
> results to me daily, weekly and monthly. 
>  
> Is there any type of Red Hat ES 4 compatible maintenance scripting system
> like this available for administrators? I'm willing to pay! :)
>  
> Thank you! -Anne
>  
>  

-- 
veritatas simplex oratio est
		-Seneca

Andrew Bacchi
Systems Programmer
Rensselaer Polytechnic Institute
phone: 518.276.6415  fax: 518.276.2809

http://www.rpi.edu/~bacchi/




More information about the redhat-list mailing list