[FX.php List] Catch FileMaker Server before it dies?
BEVERLY VOTH
beverlyvoth at gmail.com
Sat May 26 11:00:51 MDT 2012
just a small question, Bob! Why "FMFindAll()" instead of "FMFindAny()"? would that work and be sufficient?
Beverly
On 26 May 2012, at 12:51 PM, Bob Patin wrote:
> Here's the entire page (with all but one server removed for brevity) for each FM server that I use; as you'll see, I do a simple FINDALL to see if it responds, and if it doesn't, it'll send me an email; if it succeeds, it updates the page, on which I have each server displayed, and the last time the test occurred.
>
> A simple META REFRESH reloads the page every 5 minutes, which runs the test.
>
> Sending SMS is rather easy; it's just an email SEND, but to an AT&T email address (phone#@txt.att.net). Here is a list of all the various email addresses for US carriers:
>
> • AT&T: number at txt.att.net
> • Qwest: number at qwestmp.com
> • T-Mobile: number at tmomail.net
> • Verizon: number at vtext.com
> • Sprint: number at messaging.sprintpcs.com or number at pm.sprint.com
> • Virgin Mobile: number at vmobl.com
> • Nextel: number at messaging.nextel.com
> • Alltel: number at message.alltel.com
> • Metro PCS: number at mymetropcs.com
> • Powertel: number at ptel.com
> • Boost Mobile: number at myboostmobile.com
> • Suncom: number at tms.suncom.com
> • Tracfone: number at mmst5.tracfone.com
> • U.S. Cellular: number at email.uscc.net
> There's a mail_function page that is included in this as well; if anyone wants it, email me back-channel and I'll be glad to send it to you. I got it from someone years ago and have used it for all my mail-sending in PHP.
>
>
> <HTML>
> <HEAD>
> <META HTTP-EQUIV="Refresh" CONTENT="300;url=http://www.longtermsolutions.com/uptest2.php">
> <link href="includes/uptest_css.css" rel="stylesheet" type="text/css">
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <title>WPE Uptest</title>
> </HEAD>
> <BODY BGCOLOR="#FFFFFF" class="verd6p">
> <div class="message verd16_reverse" style="background-color:#666666">
> WEB PUBLISHING ENGINE<br>
> LAST TEST: <?php echo date("m/d/Y h:i A"); ?> <br>
> NEXT TEST: <?php echo date("m/d/Y h:i A" , time() + 300 ); ?></div>
>
> <?php
> error_reporting(0);
>
> include_once('FX/FX.php');
> include_once('FX/server_data.php');
> include_once('mail_function.php');
>
> // fms2 ------------------------------------------------------------------
> $machine = "fms2";
> $serverIP = "xs2.longtermsolutions.com";
>
> $now = strtotime(date("h:i:s"));
>
> // load data
> $q =new FX($serverIP,$webCompanionPort, $dataType, $scheme);
> $q->SetDBData('wpe_test.fp7','data' );
> $q->SetDBPassword($testpw,$testun);
> $qResult = $q->FMFindAll();
>
> $later = strtotime(date("h:i:s"));
>
> if ($later - $now > 3){
> $color = "#FFADA7";
> $message = $machine." IS NOT FUNCTIONAL.";
>
> // send email
> $body = $machine.": ".$message."\n";
> $body .= "Tested: ".date("m/d/Y h:i:s A");
> $to="bob at patin.com";
> $from="info@*********";
> $subject='Server '.$machine.' Reply Test at '.date("m/d/Y h:i:s A");
> $replyto=$from;
> sock_mail(1, $to, $subject , $body, $replyto , $from);
> // send sms
> $body = $machine.": ".$message." -- ".date("m/d/Y h:i:s A");
> $to="615*******@txt.att.net";
> $from="info@***********";
> $subject='Server '.$machine.' Reply Test at '.date("m/d/Y h:i:s A");
> $replyto=$from;
> sock_mail(1, $to, $subject , $body, $replyto , $from);
> }else{
> $color = "#ABFCAE";
> $message = "OK";
> $body = $machine.": ".$message." -- ".date("m/d/Y h:i:s A");
> }
>
> echo '<div class="message" style="background-color:'.$color.'">'.nl2br($body).'</div>';
>
> // other servers would go here...
>
> ?>
>
> </BODY>
> </HTML>
>
> On May 25, 2012, at 12:23 PM, Anders Monsen wrote:
>
>> Bob,
>>
>> What PHP function do you use for the SMS? When I set up something similar recently the PHP send mail script failed to send any mail using working SMTP settings.
>>
>> I ended up creating a web page that logged successes and failures in a db and running a server side script that would send the email, which has the downside of a delay.
>>
>> However, I also run a cron which checks the WPE process and starts this up via the command line, so if everything works no intervention is required by the DBA.
>>
>> Anders
More information about the FX.php_List
mailing list