コード例 #1
0
ファイル: cycle.php プロジェクト: novozhenets/majordomo
  $tm=time();
 }
 $start_time=time();

 include_once(DIR_MODULES.'rss_channels/rss_channels.class.php');
 $rss_ch=new rss_channels();

 include_once(DIR_MODULES.'pinghosts/pinghosts.class.php');
 $pinghosts=new pinghosts();

 include_once(DIR_MODULES.'webvars/webvars.class.php');
 $webvars=new webvars();


 include_once(DIR_MODULES.'watchfolders/watchfolders.class.php');
 $watchfolders=new watchfolders();

 if (defined('ONEWIRE_SERVER')) {
  include_once(DIR_MODULES.'onewire/onewire.class.php');
  $onw=new onewire();
 }



 while (1) {
  if ((time()-$tm)>$long_delay_limit) {
   // where am I ?
   $sleeptime=time()-$tm;
   echo "waked up (sleeped: $sleeptime)\n";
   getObject('ThisComputer')->raiseEvent("WakedUp", array('sleeptime'=>$sleeptime));
  }
コード例 #2
0
<?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();
include_once DIR_MODULES . 'watchfolders/watchfolders.class.php';
$watchfolders = new watchfolders();
$checked_time = 0;
echo date("H:i:s") . " running " . basename(__FILE__) . PHP_EOL;
while (1) {
    if (time() - $checked_time > 10) {
        $checked_time = time();
        setGlobal(str_replace('.php', '', basename(__FILE__)) . 'Run', time(), 1);
        // checking all watching folders
        $watchfolders->checkAllFolders();
    }
    if (file_exists('./reboot') || isset($_GET['onetime'])) {
        $db->Disconnect();
        exit;
    }
    sleep(1);
}
DebMes("Unexpected close of cycle: " . basename(__FILE__));