How to use send_wol_wakeup method of pts_phoromatic_event_server class

Best Phoronix-test-suite code snippet using pts_phoromatic_event_server.send_wol_wakeup

pts_phoromatic_event_server.php

Source:pts_phoromatic_event_server.php Github

copy

Full Screen

...17 along with this program. If not, see <http://www.gnu.org/licenses/>.18*/19class pts_phoromatic_event_server20{21 protected function send_wol_wakeup($mac, $ip)22 {23 $sent_wol_request = false;24 if(PTS_IS_DAEMONIZED_SERVER_PROCESS)25 {26 foreach(array('etherwake', 'ether-wake') as $etherwake)27 {28 if(pts_client::executable_in_path($etherwake))29 {30 shell_exec($etherwake . ' ' . $mac . ' 2>&1');31 $sent_wol_request = true;32 sleep(5);33 break;34 }35 }36 }37 if(true || $sent_wol_request == false) // TODO XXX: right now sending both packets while debugging network issues38 {39 pts_network::send_wol_packet($ip, $mac);40 $sent_wol_request = true;41 }42 return $sent_wol_request;43 }44 public static function ob_cache_run()45 {46 pts_openbenchmarking::available_tests(true);47 pts_openbenchmarking::available_suites(true);48 }49 public function __construct()50 {51 $systems_already_reported = array();52 pts_client::fork(array('pts_phoromatic_event_server', 'ob_cache_run'), null);53 $is_first_run = true;54 while(true)55 {56 $hour = date('G');57 $minute = date('i');58 phoromatic_server::prepare_database();59 if($is_first_run || $minute == 0)60 {61 if($is_first_run || $hour == 8)62 {63 pts_client::fork(array('pts_phoromatic_event_server', 'ob_cache_run'), null);64 }65 // Check for basic hung systems66 $stmt = phoromatic_server::$db->prepare('SELECT LastCommunication, CurrentTask, EstimatedTimeForTask, SystemID, AccountID, LastIP FROM phoromatic_systems WHERE State > 0 ORDER BY LastCommunication DESC');67 $result = $stmt ? $stmt->execute() : false;68 while($result && $row = $result->fetchArray())69 {70 $last_comm = strtotime($row['LastCommunication']);71 if($last_comm > (time() - 3600))72 continue; // if last comm time is less than an hour, still might be busy testing73 if($last_comm < (time() - (3600 * 3)) && !$is_first_run)74 continue; // it's already been reported enough for now...75 if(stripos($row['CurrentTask'], 'shutdown') !== false || stripos($row['CurrentTask'], 'shutting down') !== false)76 continue; // if the system shutdown, no reason to report it77 if(phoromatic_server::estimated_time_remaining_diff($row['EstimatedTimeForTask'], $row['LastCommunication']) > 0)78 continue; // system task time didn't run out yet79 // UPDATE SYSTEM STATUS TO "UNKNOWN"80 $stmt_unknown = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET CurrentTask = :unknown_state WHERE AccountID = :account_id AND SystemID = :system_id');81 $stmt_unknown->bindValue(':account_id', $row['AccountID']);82 $stmt_unknown->bindValue(':system_id', $row['SystemID']);83 $stmt_unknown->bindValue(':unknown_state', 'Unknown');84 $stmt_unknown->execute();85 $stmt_email = phoromatic_server::$db->prepare('SELECT UserName, Email FROM phoromatic_users WHERE UserID IN (SELECT UserID FROM phoromatic_user_settings WHERE AccountID = :account_id AND NotifyOnHungSystems = 1) AND AccountID = :account_id');86 $stmt_email->bindValue(':account_id', $row['AccountID']);87 $result_email = $stmt_email->execute();88 while($row_email = $result_email->fetchArray())89 {90 if(empty($row_email['Email']))91 continue;92 phoromatic_server::send_email($row_email['Email'], 'Phoromatic System Potential Hang: ' . phoromatic_server::system_id_to_name($row['SystemID'], $row['AccountID']), phoromatic_server::account_id_to_group_admin_email($row['AccountID']), '<p><strong>' . $row_email['UserName'] . ':</strong></p><p>One of the systems associated with your Phoromatic account has not been communicating with the Phoromatic Server in more than sixty minutes. Below is the system information details:</p><p><strong>System:</strong> ' . phoromatic_server::system_id_to_name($row['SystemID'], $row['AccountID']) . '<br /><strong>Last Communication:</strong> ' . phoromatic_server::user_friendly_timedate($row['LastCommunication']) . '<br /><strong>Last Task:</strong> ' . $row['CurrentTask'] . '<br /><strong>Local IP:</strong> ' . $row['LastIP'] . '</p>');93 }94 }95 }96 if($is_first_run || $minute % 2 == 0)97 {98 // Check for systems to wake99 $stmt = phoromatic_server::$db->prepare('SELECT LastCommunication, CurrentTask, SystemID, AccountID, NetworkMAC, LastIP, MaintenanceMode FROM phoromatic_systems WHERE State > 0 AND NetworkMAC NOT LIKE \'\' AND NetworkWakeOnLAN LIKE \'%g%\' ORDER BY LastCommunication DESC');100 $result = $stmt ? $stmt->execute() : false;101 while($result && $row = $result->fetchArray())102 {103 if(!isset($phoromatic_account_settings[$row['AccountID']]))104 {105 $stmt1 = phoromatic_server::$db->prepare('SELECT NetworkPowerUpWhenNeeded, PowerOnSystemDaily FROM phoromatic_account_settings WHERE AccountID = :account_id');106 $stmt1->bindValue(':account_id', $row['AccountID']);107 $result1 = $stmt1->execute();108 $phoromatic_account_settings[$row['AccountID']] = $result1->fetchArray(SQLITE3_ASSOC);109 }110 $last_comm = strtotime($row['LastCommunication']);111 if($last_comm < (time() - 360) && $row['MaintenanceMode'] == 1)112 {113 self::send_wol_wakeup($row['NetworkMAC'], $row['LastIP']);114 continue;115 }116 if($minute % 20 == 0 && $last_comm < (time() - (3600 * 18)) && $phoromatic_account_settings[$row['AccountID']]['PowerOnSystemDaily'] == 1)117 {118 // Daily power on test if system hasn't communicated / powered on in a day119 // XXX right now the "daily" power on test is 18 hours. change or make user value in future?120 // Just doing this check every 20 minutes as not too vital121 self::send_wol_wakeup($row['NetworkMAC'], $row['LastIP']);122 continue;123 }124 if($last_comm < (time() - 600) || stripos($row['CurrentTask'], 'Shutdown') !== false)125 {126 // System hasn't communicated in a number of minutes so it might be powered off127 if(phoromatic_server::system_has_outstanding_jobs($row['AccountID'], $row['SystemID']) !== false)128 {129 // Make sure account has network WoL enabled130 if($phoromatic_account_settings[$row['AccountID']]['NetworkPowerUpWhenNeeded'] == 1)131 {132 self::send_wol_wakeup($row['NetworkMAC'], $row['LastIP']);133 }134 }135 }136 }137 }138 if($minute % 8 == 0 && $hour > 1)139 {140 // See if system appears down141 $stmt = phoromatic_server::$db->prepare('SELECT LastCommunication, CurrentTask, SystemID, AccountID, LastIP FROM phoromatic_systems WHERE State > 0 ORDER BY LastCommunication DESC');142 $result = $stmt ? $stmt->execute() : false;143 while($result && ($row = $result->fetchArray()))144 {145 $sys_hash = sha1($row['AccountID'] . $row['SystemID']);146 // Avoid sending duplicate messages over time...

Full Screen

Full Screen

send_wol_wakeup

Using AI Code Generation

copy

Full Screen

1require_once('pts_phoromatic_event_server.php');2$phoromatic_server = new pts_phoromatic_event_server();3$phoromatic_server->send_wol_wakeup('00:00:00:00:00:00');4require_once('pts_phoromatic_event_server.php');5$phoromatic_server = new pts_phoromatic_event_server();6$phoromatic_server->send_wol_wakeup('00:00:00:00:00:00', '00:00:00:00:00:01', '00:00:00:00:00:02', '00:00:00:00:00:03');7require_once('pts_phoromatic_event_server.php');8$phoromatic_server = new pts_phoromatic_event_server();9$mac_addresses = array('00:00:00:00:00:00', '00:00:00:00:00:01', '00:00:00:00:00:02', '00:00:00:00:00:03');10$phoromatic_server->send_wol_wakeup($mac_addresses);11require_once('pts_phoromatic_event_server.php');

Full Screen

Full Screen

send_wol_wakeup

Using AI Code Generation

copy

Full Screen

1$phoromatic_event_server = new pts_phoromatic_event_server();2$phoromatic_event_server->send_wol_wakeup('00:00:00:00:00:00');3$phoromatic_event_server = new pts_phoromatic_event_server();4$phoromatic_event_server->send_wol_wakeup('00:00:00:00:00:00');5$phoromatic_event_server = new pts_phoromatic_event_server();6$phoromatic_event_server->send_wol_wakeup('00:00:00:00:00:00');7$phoromatic_event_server = new pts_phoromatic_event_server();8$phoromatic_event_server->send_wol_wakeup('00:00:00:00:00:00');9$phoromatic_event_server = new pts_phoromatic_event_server();10$phoromatic_event_server->send_wol_wakeup('00:00:00:00:00:00');11$phoromatic_event_server = new pts_phoromatic_event_server();12$phoromatic_event_server->send_wol_wakeup('00:00:00:00:00:00');13$phoromatic_event_server = new pts_phoromatic_event_server();14$phoromatic_event_server->send_wol_wakeup('00:00:00:00:00:00');15$phoromatic_event_server = new pts_phoromatic_event_server();16$phoromatic_event_server->send_wol_wakeup('00:00:00:00:

Full Screen

Full Screen

send_wol_wakeup

Using AI Code Generation

copy

Full Screen

1require_once('pts_phoromatic_event_server.php');2$event_server = new pts_phoromatic_event_server();3$event_server->send_wol_wakeup('mac_address');4require_once('pts_phoromatic_event_server.php');5$event_server = new pts_phoromatic_event_server();6$event_server->send_wol_wakeup('mac_address');7require_once('pts_phoromatic_event_server.php');8$event_server = new pts_phoromatic_event_server();9$event_server->send_wol_wakeup('mac_address');10require_once('pts_phoromatic_event_server.php');11$event_server = new pts_phoromatic_event_server();12$event_server->send_wol_wakeup('mac_address');13require_once('pts_phoromatic_event_server.php');14$event_server = new pts_phoromatic_event_server();15$event_server->send_wol_wakeup('mac_address');16require_once('pts_phoromatic_event_server.php');17$event_server = new pts_phoromatic_event_server();18$event_server->send_wol_wakeup('mac_address');19require_once('pts_phoromatic_event_server.php');20$event_server = new pts_phoromatic_event_server();21$event_server->send_wol_wakeup('mac_address');22require_once('pts_phoromatic_event_server.php');23$event_server = new pts_phoromatic_event_server();24$event_server->send_wol_wakeup('mac_address');

Full Screen

Full Screen

send_wol_wakeup

Using AI Code Generation

copy

Full Screen

1$es = new pts_phoromatic_event_server();2$es->send_wol_wakeup();3$es = new pts_phoromatic_event_server();4$es->send_wol_wakeup();5$es = new pts_phoromatic_event_server();6$es->send_wol_wakeup();7$es = new pts_phoromatic_event_server();8$es->send_wol_wakeup();9$es = new pts_phoromatic_event_server();10$es->send_wol_wakeup();11$es = new pts_phoromatic_event_server();12$es->send_wol_wakeup();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in pts_phoromatic_event_server

Trigger send_wol_wakeup code on LambdaTest Cloud Grid

Execute automation tests with send_wol_wakeup on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful