Example #1
0
 $is_cgminer_running = $rpc->is_cgminer_running();
 $has_defunc = $rpc->is_cgminer_defunc();
 $notify_cgminer_restart = $notification_data['notify_cgminer_restart'];
 $notify_reboot = $notification_data['notify_reboot'];
 // If PHPMiner should check for defunc.
 if (!empty($notification_data['reboot_defunc'])) {
     // Check if there is a defunced cgminer process.
     $rigs_to_reboot[$rig] = $has_defunc;
     if (!empty($rigs_to_reboot[$rig]) && $notify_reboot) {
         $notifications['reboot'][$rig] = array('Needed to reboot rig ' . $rig . '.');
     }
 }
 // Precheck if cgminer is running
 if (!empty($notification_data['restart_cgminer']) && !$is_cgminer_running) {
     // Try to restart cgminer.
     $rpc->restart_cgminer();
     if ($notify_cgminer_restart) {
         $notifications['cgminer_restart'][$rig] = array('Needed to restart CGMiner/SGMiner on rig ' . $rig . '.');
     }
     // Give cgminer time to start the api.
     sleep(10);
 }
 // Precheck if cgminer is running
 if (!empty($notification_data['restart_dead']) && $is_cgminer_running) {
     try {
         $rig_cfg = $system_config['rigs'][$rig];
         $api = new PHPMinerRPC($rig_cfg['http_ip'], $rig_cfg['http_port'], $rig_cfg['rpc_key']);
         $api->test_connection();
         $data = $api->get_devices();
         $dead_sick_gpu = false;
         foreach ($data as $device_data) {