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

[cobalt-users] OT Shell/Perl Script



I am trying to setup and shell/perl script that will email me the state my
server is in and was wandering if some could help.  Basicly I have the perl
script done but I am unsure how I can get the output mailed to me.  Here is
the script

#!/usr/bin/perl

$cputemp=`cat /proc/cpuinfo | grep temperature | cut -b 15,16,17,18`;

$uptime = `/usr/bin/uptime`;

$disk = `df -h`;

$mem= `cat /proc/meminfo`;

$proc = `ps auxc | wc -l`;
$proc =~ /(\d+)/;
$procnum = $proc - 3;

$netstat = `netstat`;

$netstat3 = `netstat -l`;

$netstat2 = `netstat --statistics`;

print $uptime;
print "\n";

print 'Number of Processes ';
print $procnum;
print "\n";
print "\n";

print 'CPU Temp ';
print $cputemp;
print "\n";

print $mem;
print "\n";
print "\n";

print $disk;
print "\n";
print "\n";

print $netstat;
print "\n";
print "\n";

print $netstat2;
print "\n";
print "\n";

print $netstat3;
print "\n";
print "\n";