Example #1
0
 $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 {
         $api->quit();
         // Give cgminer time to quit.
         sleep(10);
         // If CGMiner still running, try to kill it
         if ($rpc->is_cgminer_running()) {
             $rpc->kill_cgminer();
             // Give cgminer time again to quit.
             sleep(5);
         }
         // Try to restart cgminer.
         $rpc->restart_cgminer();
         // Give cgminer time to start the api.
         sleep(10);
         if ($notify_cgminer_restart) {
             $notifications['cgminer_restart'][$rig] = array('Needed to restart CGMiner/SGMiner on rig ' . $rig . ' because of Dead/Sick GPU.');
         }