From: x2000habouzit Date: Sat, 2 Oct 2004 15:28:11 +0000 (+0000) Subject: gpl + cron X-Git-Tag: xorg/old~1458 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=0e638df77d8d343b3a162049763e0c225b5c0576;p=platal.git gpl + cron --- diff --git a/scripts/cron/checkdb.php b/scripts/cron/checkdb.php index 6668597..f2d87d8 100755 --- a/scripts/cron/checkdb.php +++ b/scripts/cron/checkdb.php @@ -1,9 +1,30 @@ #!/usr/bin/php4 -q dbhost,$globals->dbuser,$globals->dbpwd); diff --git a/scripts/cron/cron_validations.php b/scripts/cron/cron_validations.php new file mode 100755 index 0000000..30f4c67 --- /dev/null +++ b/scripts/cron/cron_validations.php @@ -0,0 +1,63 @@ +#!/usr/bin/php4 -q +dbhost,$globals->dbuser,$globals->dbpwd); +mysql_select_db($globals->dbdb); + +$sql = mysql_query("SELECT count(stamp), sum(stamp < NOW() - $M_PERIOD), sum(stamp < NOW() - $R_PERIOD) FROM x4dat.requests"); +list($nb,$nbold,$nbveryold) = mysql_fetch_row($sql); +mysql_free_result($sql); + +if(empty($nb)) + exit; + +$mymail = new DiogenesMailer('validation@polytechnique.org', + "validation@polytechnique.org", + (empty($nbveryold)?"":"[urgent] ")."il y a $nb validations non effectuées", + false, ""); + +$message = + "il y a $nb validation à effectuer \n" + .(empty($nbold)?"":"dont $nbold depuis le dernier mail !!!\n") + .(empty($nbveryold)?"":"et dont *$nbveryold* sont en retard de plus de 6h !!!") + ."\n" + ."https://www.polytechnique.org/admin/valider.php\n"; + +$message = wordwrap($message,78); +$mymail->setBody($message); +$mymail->send(); +?>