<?php /** * 后台任务管理进程 * 进程重启 * * @author zhangh@uuzu.com * @date 2011-10-01 */ define('UUZU_AUTH', 0); require dirname(__FILE__) . '/global.php'; TenYear::getInstance(); require PROCESS_PATH . '/Process/Server.php'; $objProcess = new Process_Server(); $mainProcess = false; $scriptFile = PROCESS_PATH . '/Process/Control.php'; #Control进程 $hostIP = Com_System::get_host_ip(); if ($hostIP == PROCESS_MAIN_IP) { $mainProcess = true; } # kill Control进程 while (true) { if (Process_Server::killProcess($scriptFile, CLI_PATH)) { break; } sleep(1); } # 获取process_list配置表进程列表,并按条件kill $processList = $objProcess->getProcessList(); foreach ($processList as $process) {
//后台进程管理脚本 define('UUZU_AUTH', 0); require dirname(__FILE__) . '/../global.php'; TenYear::getInstance(); ini_set('default_socket_timeout', -1); Com_AdCache::factory()->set_timeout(0); $controlFile = __FILE__; $logPath = '/tmp/logs'; $mainProcess = false; $hostIP = Com_System::get_host_ip(); if ($hostIP == PROCESS_MAIN_IP) { $mainProcess = true; } require PROCESS_PATH . '/Process/Server.php'; $objProcess = new Process_Server(); if (Process_Server::CheckHaveRun($controlFile, CLI_PATH)) { exit("控制进程已经运行 本次执行退出\n"); } if (!is_dir($logPath)) { mkdir($logPath); } chdir(PROCESS_PATH); //cpunum $cpuNum = Process_Server::getCpuNum(); //上次检测时间 $lastRunTime = 0; //当前检测时间 $nowRunTime = time(); //上次domain执行时间 $damonRunTime = 0;
/** * 后台任务管理进程 * 进程重启 * * @author zhangh@uuzu.com * @date 2011-10-01 */ define('UUZU_AUTH', 0); require dirname(__FILE__) . '/global.php'; TenYear::getInstance(); if (!$argv[1]) { exit("use cmd : php " . PROJECT_ROOT . "/crontab/process_file.php restart_file\n"); } require PROCESS_PATH . '/Process/Server.php'; $objProcess = new Process_Server(); $mainProcess = false; $scriptFile = PROCESS_PATH . '/Process/Control.php'; $hostIP = Com_System::get_host_ip(); $logPath = '/tmp/logs'; //cpunum $cpuNum = Process_Server::getCpuNum(); if ($hostIP == PROCESS_MAIN_IP) { $mainProcess = true; } $processConfig = array(); $processList = $objProcess->getProcessList(); foreach ($processList as $process) { if ($process['process_interval'] || $process['process_file'] != $argv[1]) { continue; }