Re: cron scripts for maintenance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx',
     '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/

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux