Re: Friday morning brain farts....

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

 



On Fri, 2007-08-10 at 11:48 -0400, Daniel Brown wrote:
> On 8/10/07, Stut <stuttle@xxxxxxxxx> wrote:
> > .... I get an email from each
> > server containing the contents of the error log from the previous day
> > and my first task each day is to go through that and track down any
> > issues that usage has highlighted.
> 
>     That's actually a good point there that I can take away from this.
>  I actually don't have anything set to send me a log of code issues,
> only when an error is caused (and, of course, anything server-related,
> but that's a different point entirely).

Simple enough... put the following in a file, and add a cron job.

#!/usr/bin/php -qC
<?php

if( !isset( $argv[1] ) || !isset( $argv[2] ) || !isset( $argv[3] ) )
{
    echo "Usage: {$argv[0]} <subject> <email> <path>\n";
    exit( 1 );
}

$subject = $argv[1];
$email   = $argv[2];
$path    = $argv[3];

$content = implode( '', file( $path ) );

if( trim( $content ) === '' )
{
    $content = 'NO ERRORS TODAY!!!';
}

mail( $email, $subject, $content );

?>

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux