Story Code Test

Big Cheese's picture

Some code is always an interesting proposition.

<?php
$a = 1;
$a++;
mysql_connect();
 
?>

Splitting up is always hard to do.

use Win32::AdminMisc;
use Mail::Sendmail;
use strict;
my ($total, $free, %mail,
	$machine, $drive, $low,
	$to, $from, # Email addresses
	);
$machine = 'DBSQL01';
$drive = "c:/";
$low = 50000000; # 50MB
$to = 'notify@address.com';
$from = "$machine\@address.com";
 
my $VERSION = 0.1;
 
while (sleep 43200)	{ # Check every 12 hours
	($total, $free) = Win32::AdminMisc::GetDriveSpace($drive);
	print "$free bytes remaining\n";
 
	if ($free < $low)	{
		%mail = (To => $to,
	    		From => $from,
	    		Subject => "$machine low on disk space",
	    		Message => "$machine is low on disk space again.
	    					($free bytes remaining.)"
	    );
	    sendmail(%mail) or die $Mail::Sendmail::error;
	}  # End if;
}  #  Wend

No comments

Please register or login to post a comment.

Site Counter

  • Site Counter: 2083
  • Unique Visitor: 378
  • Registered Users: 2
  • Unregistered Users: 0
  • Published Nodes: 15
  • Unpublished Nodes: 0
  • Your IP: 38.103.63.59
  • Since: 2008-09-11