|
Last change
on this file was 929, checked in by chronos, 4 years ago |
- Modified: Removed commended out print_r and echo commands used only for debugging.
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | if (isset($_SERVER['REMOTE_ADDR'])) die();
|
|---|
| 4 | include_once(dirname(__FILE__).'/../../Application/Core.php');
|
|---|
| 5 | $System = new Core();
|
|---|
| 6 | $System->ShowPage = false;
|
|---|
| 7 | $System->Run();
|
|---|
| 8 |
|
|---|
| 9 | $Now = time();
|
|---|
| 10 | $DbResult = $System->Database->select('NetworkConfiguration', '*, UNIX_TIMESTAMP(`LastTime`)', '(`Changed` = 1) AND (`Enabled` = 1)');
|
|---|
| 11 | while ($Service = $DbResult->fetch_assoc())
|
|---|
| 12 | {
|
|---|
| 13 | if ($Service['UNIX_TIMESTAMP(LastTime)'] < (time() - $Service['Period']))
|
|---|
| 14 | {
|
|---|
| 15 | $System->Database->update('NetworkConfiguration', '`Id`='.$Service['Id'], array('Changed' => 2));
|
|---|
| 16 | $ExecutionStart = time();
|
|---|
| 17 |
|
|---|
| 18 | $ExecuteParts = explode('|', $Service['Execute']);
|
|---|
| 19 | $Output = array();
|
|---|
| 20 | foreach ($ExecuteParts as $Command)
|
|---|
| 21 | {
|
|---|
| 22 | if ($Command != '')
|
|---|
| 23 | {
|
|---|
| 24 | exec($Command, $Output);
|
|---|
| 25 | }
|
|---|
| 26 | }
|
|---|
| 27 | $ExecutionTime = time() - $ExecutionStart;
|
|---|
| 28 | $System->Database->update('NetworkConfiguration', '`Id`='.$Service['Id'], array('Changed' => 0, 'LastTime' => 'NOW()', 'ExecutionTime' => $ExecutionTime));
|
|---|
| 29 | $System->Database->update('NetworkConfiguration', '`Id`='.$Service['Id'], array('Log' => implode("\n", $Output)));
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.