Commit 20a45f87 authored by Kevin Atkinson's avatar Kevin Atkinson

Add option to mail output of the command to SUEXEC and use that to

mail output of newproj to testbed-logs.
parent abd8685d
......@@ -336,6 +336,8 @@ define("SUEXEC_ACTION_DIE", 1);
define("SUEXEC_ACTION_USERERROR", 2);
define("SUEXEC_ACTION_IGNORE", 3);
define("SUEXEC_ACTION_DUPDIE", 4);
# SUEXEC_ACTION_MAIL_TBLOGS to be ored with one of the above actions
define("SUEXEC_ACTION_MAIL_TBLOGS", 64);
#
# An suexec error.
......@@ -378,6 +380,13 @@ function SUEXEC($uid, $gid, $cmdandargs, $action) {
global $TBSUEXEC_PATH;
global $suexec_cmdandargs, $suexec_retval;
global $suexec_output, $suexec_output_array;
global $TBMAIL_LOGS;
$mail_tblog = 0;
if ($action & SUEXEC_ACTION_MAIL_TBLOGS) {
$action &= ~SUEXEC_ACTION_MAIL_TBLOGS;
$mail_tblog = 1;
}
ignore_user_abort(1);
......@@ -400,6 +409,15 @@ function SUEXEC($uid, $gid, $cmdandargs, $action) {
}
}
if ($mail_tblog) {
$mesg = "$TBSUEXEC_PATH $suexec_cmdandargs\n";
$mesg .= "Return Value: $suexec_retval\n\n";
$mesg .= "--------- OUTPUT ---------\n";
$mesg .= $suexec_output;
TBMAIL($TBMAIL_LOGS, "suexec: $cmdandargs", $mesg);
}
#
# The output is still available of course, via $suexec_output.
#
......
......@@ -264,7 +264,7 @@ class Project
chmod($xmlname, 0666);
$retval = SUEXEC("nobody", "nobody", "webnewproj $xmlname",
SUEXEC_ACTION_IGNORE);
SUEXEC_ACTION_IGNORE | SUEXEC_ACTION_MAIL_TBLOGS);
if ($retval) {
if ($retval < 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