On 06-Jul-01 Jerry Lake wrote:
> Is it possible the set a script
> to email a file after it becomes so many lines
> long ? I have an email address that accepts
> only catalog requests and I'd like to be able
> to have a complete list mailed to me instead of
> doing it one at a time.
> 

$fname='catrequest.log';
$fdone=$fname .'.tst';
        
unlink($fdone);
link($fname, $fdone);
unlink($fname);

$cmd="/usr/bin/wc -l fdone";
$p=popen($cmd, 'r');
if ($p) {
    $lines=fgets($p,256);
    if ( ($lines +0) > 10) {
        `/usr/bin/mail -s "Catalog Requessts" [EMAIL PROTECTED] < $fdone`;
    } else {
         `/bin/cat $fdone >> $fname`;
    }
        
    pclose($p);
}
`
Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to