How do i execute a function when poweroff is triggered?
// need to make sure here that poweroff command is executed successfully before calling senEmail function
$output = exec('poweroff', $output, $return);
if (!$return) {
// command executed successfully
// now send email before poweroff completes its process
sendEmail();
}
sendEmail()
is not triggered since shutdown is already processing.