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) { if (strtolower($device_data['Status']) == 'dead' || strtolower($device_data['Status']) == 'sick') { $dead_sick_gpu = true; break; } } // Restart CGMiner if dead/sick gpu is found. if ($dead_sick_gpu) { if ($notification_data['restart_dead'] === 'reboot') { $rigs_to_reboot[$rig] = true; if ($notify_reboot) { $notifications['reboot'][$rig] = array('Needed to reboot CGMiner/SGMiner on rig ' . $rig . ' because of Dead/Sick GPU.'); } } else {