Commit 8e6c0141 authored by Leigh Stoller's avatar Leigh Stoller

Clean up and do the zombie prevention stuff like I did in

sprewlogfile. Also add -w (waitmode) when calling node_reboot so that
user gets to wait until all the nodes come back up.
parent ab8b901f
......@@ -102,38 +102,48 @@ if (!$confirmed) {
}
#
# Pass it off to the script.
# For the audit message.
#
$retval = 0;
header("Content-Type: text/plain");
ignore_user_abort(1);
TBUserInfo($uid, $uid_name, $uid_email);
if ($nodemode) {
$result = system("$TBSUEXEC_PATH $uid nobody webnodereboot $node_id",
$retval);
$message = "$node_id was rebooted via the web interface by $uid\n";
$subject = "Node Reboot: $node_id";
}
else {
$result = system("$TBSUEXEC_PATH $uid nobody webnodereboot -e $pid,$eid",
$retval);
}
if ($retval) {
USERERROR("Reboot failed!", 1);
$message = "Nodes in $pid/$eid were rebooted via the web interface ".
"by $uid\n";
$subject = "Nodes Rebooted: $pid/$eid";
}
#
# And send an audit message.
# A cleanup function to keep the child from becoming a zombie, since
# the script is terminated, but the children are left to roam.
#
TBUserInfo($uid, $uid_name, $uid_email);
$fp = 0;
function SPEWCLEANUP()
{
global $fp;
if (connection_aborted() && $fp) {
pclose($fp);
}
exit();
}
register_shutdown_function("SPEWCLEANUP");
ignore_user_abort(1);
if ($nodemode) {
$message = "$node_id was rebooted via the web interface by $uid\n";
$subject = "Node Reboot: $node_id";
$fp = popen("$TBSUEXEC_PATH $uid nobody webnodereboot -w $node_id",
"r");
}
else {
$message = "Nodes in $pid/$eid were rebooted via the web interface ".
"by $uid\n";
$subject = "Nodes Rebooted: $pid/$eid";
$fp = popen("$TBSUEXEC_PATH $uid nobody webnodereboot -w -e $pid,$eid",
"r");
}
if (! $fp) {
USERERROR("Reboot failed!", 1);
}
TBMAIL($TBMAIL_AUDIT,
......@@ -141,13 +151,18 @@ TBMAIL($TBMAIL_AUDIT,
"From: $uid_name <$uid_email>\n".
"Errors-To: $TBMAIL_WWW");
#
# Spit out a redirect so that the history does not include a post
# in it.
#
#if ($nodemode)
# header("Location: shownode.php3?node_id=$node_id");
#else
# header("Location: showexp.php3?exp_pid=$pid&exp_eid=$eid");
header("Content-Type: text/plain");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
flush();
while (!feof($fp)) {
$string = fgets($fp, 1024);
echo "$string";
flush();
}
pclose($fp);
$fp = 0;
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment