Skip to content

Instantly share code, notes, and snippets.

@ataliba
Created April 13, 2012 12:35
Show Gist options
  • Save ataliba/2376634 to your computer and use it in GitHub Desktop.
Save ataliba/2376634 to your computer and use it in GitHub Desktop.
A simple script I create in the past to monitoring my blog/site
<?php
$arquivo = "$HOME/logs/uptime";
$abre = fopen($arquivo,"a+");
$ip = "mysite.com.br";
$comando = "/arpa/af/c/cerebro/bin/commands/httping -c 1 -g http://".$ip;
$saida = shell_exec($comando);
$texto = "Site : $ip";
if ( ereg("1 ok",$saida) ) {
$texto = $texto. " you site is up [ ";
} else {
$texto = $texto." you site is down [ ";
}
$texto = $texto;
$data = date(r);
$texto = $texto.$data." ] \n";
fwrite($abre,$texto);
fclose($abre);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment