You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							43 lines
						
					
					
						
							1.2 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							43 lines
						
					
					
						
							1.2 KiB
						
					
					
				| <?php | |
| /** | |
|  * Cron监控程序 | |
|  * | |
|  * @copyright(c)2011,weibo All rights reserved. | |
|  * @author 王勇 <wangyong1@staff.sina.com.cn> | |
|  * @version 3.0 - 2011-11-25 | |
|  * @package crontab | |
|  */ | |
| include_once dirname(__FILE__).'/base/cronBase.php'; | |
| include_once dirname(__FILE__).'/base/dealBase.php'; | |
| 
 | |
| class MonCron extends cronBase { | |
| 
 | |
|     public function setPara() { | |
| 
 | |
|         $obj = new mDaemon(); | |
|         $rdobj = $obj->initRedis(); | |
| 
 | |
|         $server_ip = $obj->getServerIp(); | |
| 
 | |
|         // 是否存在需要启动的代理 | |
|         $proxy_exec_list = $obj->getProxyExecListByIp($server_ip); | |
|         if(is_array($proxy_exec_list) && count($proxy_exec_list) >0) { | |
|             $res = $rdobj->lpush(sprintf(_RQ_START_PROXY, $server_ip), $server_ip); | |
|         } | |
| 
 | |
|         $timestamp = $rdobj->get(sprintf(_RD_RESTART_SERVER, $server_ip)); | |
|         if(empty($timestamp)) { | |
|             $rdobj->set(sprintf(_RD_RESTART_SERVER, $server_ip), time()); | |
|         } | |
| 
 | |
|         $daemon = $obj->getStartProcConf($server_ip); | |
| 
 | |
|         $this->process = $daemon['flag2proc']; | |
|         $this->procnumlist = $daemon['flag2maxnum']; | |
|         $this->maxtimelist = $daemon['flag2maxtime']; | |
| 
 | |
|         return ; | |
|     } | |
| } | |
| 
 | |
| new MonCron;
 | |
| 
 |