Fix checkRpItemsPosition
[ryzomcore.git] / web / public_php / admin / crons / cron_harddisk.php
blob7a6f93d3111c4abc9e7ecd9c97ed2f21366012bf
1 <?php
3 ob_start();
4 set_time_limit(180); // 3 min time out
6 define('NELTOOL_NO_USER_NEEDED', true);
7 define('NELTOOL_CRON_DEBUG', false);
9 if ($_GET['dbg']) define('NELTOOL_CRON_DEBUG', true);
11 if (defined('NELTOOL_CRON_DEBUG')) echo "Checking HDs ... \n";
13 require_once('../common.php');
14 require_once('../functions_tool_main.php');
16 $domainList = tool_admin_domains_get_list();
17 $service_command = "aes.execScript df";
18 if (defined('NELTOOL_CRON_DEBUG')) echo "domainList\n". print_r($domainList,true) ."\n";
20 $aesList = array();
22 if (is_array($domainList))
24 reset($domainList);
25 foreach($domainList as $domain_data)
27 if ($domain_data['domain_hd_check'] == 1)
29 //echo '<pre>'. print_r($domain_data, true) .'</pre>';
31 $adminService = new MyAdminService;
32 if (@$adminService->connect($domain_data['domain_as_host'], $domain_data['domain_as_port'], $res) !== false)
34 $status = $adminService->getStates();
35 $domainServices = tool_main_parse_status($status);
36 $aesList = tool_main_get_aes_from_status($domainServices);
38 //echo '<pre>'. print_r($aesList, true) .'</pre>';
40 if (sizeof($aesList))
42 reset($aesList);
43 foreach($aesList as $service)
45 $adminService->serviceCmd($service, $service_command);
46 if (!$adminService->waitCallback())
48 // error
52 $aes_df_result = $tpl->get_template_vars('tool_execute_result');
53 $tpl->clear_assign('tool_execute_result');
55 if (defined('NELTOOL_NO_USER_NEEDED') && defined('NELTOOL_CRON_DEBUG')) echo '<pre>'. print_r($aes_df_result, true) .'</pre>';
57 tool_main_update_hd_data_for_domain($domain_data['domain_id'], $aes_df_result);
60 unset($adminService);
67 if (defined('NELTOOL_CRON_DEBUG')) echo "checked ". sizeof($aesList) ." servers!\n";
69 if (defined('NELTOOL_CRON_DEBUG'))
71 if ($fp = fopen("./logs/checkdisk_". date("YmdHis", time()) .".log", "w"))
73 fputs($fp, ob_get_contents());
74 fclose($fp);
78 ob_end_clean();