source: trunk/system/generators/generate.php@ 276

Last change on this file since 276 was 264, checked in by george, 15 years ago
  • Opraveno: Import stavu netwatch. * Opraveno: Chybné označení dokončení restartu konfigurace.
  • Property svn:executable set to *
File size: 1.1 KB
Line 
1<?php
2
3if(isset($_SERVER['REMOTE_ADDR'])) die();
4include('../../global.php');
5
6$Now = time();
7$DbResult = $Database->select('NetworkConfiguration', '*, UNIX_TIMESTAMP(LastTime)', '(Changed = 1) AND (Enabled = 1)');
8while($Service = $DbResult->fetch_assoc())
9{
10 if($Service['UNIX_TIMESTAMP(LastTime)'] < (time() - $Service['Period']))
11 {
12 $Database->update('NetworkConfiguration', 'Id='.$Service['Id'], array('Changed' => 2));
13 $ExecutionStart = time();
14 //echo($Service['Caption'].'...');
15 $ExecuteParts = explode('|', $Service['Execute']);
16 $Output = array();
17 foreach($ExecuteParts as $Command)
18 if($Command != '')
19 {
20 exec($Command, $Output);
21 //echo($Command."\n");
22 //sleep(5);
23 }
24 //echo("Done\n");
25 $ExecutionTime = time() - $ExecutionStart;
26 $Database->update('NetworkConfiguration', 'Id='.$Service['Id'], array('Changed' => 0, 'LastTime' => 'NOW()', 'ExecutionTime' => $ExecutionTime));
27 $Database->update('NetworkConfiguration', 'Id='.$Service['Id'], array('Log' => implode("\n", $Output)));
28 }
29}
30
31?>
Note: See TracBrowser for help on using the repository browser.