예제 #1
0
  //updating RSS channels
  $to_update=SQLSelect("SELECT ID, TITLE FROM rss_channels WHERE NEXT_UPDATE<=NOW() LIMIT 1");
  $total=count($to_update);
  for($i=0;$i<$total;$i++) {
   $rss_ch->updateChannel($to_update[$i]['ID']);
  }

  $pinghosts->checkAllHosts(1); // checking all hosts

  $webvars->checkAllVars(); // check all web vars

  $watchfolders->checkAllFolders(); // checking all watching folders

  if (defined('ONEWIRE_SERVER')) {
   $onw->updateStarred(); // check starred 1wire properties
   $onw->updateDevices(); // check all 1wire devices
  }


  if (file_exists('./reboot') || ((time()-$start_time)>7*24*60*60)) {
   $db->Disconnect();
   @unlink('./reboot');
   sleep(5);
   exit;
  }

  sleep(1); // 1 second sleep

 }
<?php

chdir(dirname(__FILE__) . '/../');
include_once "./config.php";
include_once "./lib/loader.php";
include_once "./lib/threads.php";
set_time_limit(0);
// connecting to database
$db = new mysql(DB_HOST, '', DB_USER, DB_PASSWORD, DB_NAME);
include_once "./load_settings.php";
include_once DIR_MODULES . "control_modules/control_modules.class.php";
$ctl = new control_modules();
if (!defined('ONEWIRE_SERVER')) {
    exit;
}
include_once DIR_MODULES . 'onewire/onewire.class.php';
$onw = new onewire();
echo date("H:i:s") . " running " . basename(__FILE__) . PHP_EOL;
while (1) {
    setGlobal(str_replace('.php', '', basename(__FILE__)) . 'Run', time(), 1);
    // check starred 1wire properties
    $onw->updateStarred();
    if (file_exists('./reboot') || isset($_GET['onetime'])) {
        $db->Disconnect();
        exit;
    }
    sleep(1);
}
DebMes("Unexpected close of cycle: " . basename(__FILE__));