log the stdout & stderr of each postscript to the local log file on each compute node
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5728 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
f0c2b69de1
commit
94f6e16af6
@ -259,17 +259,20 @@ if (-f $scriptname)
|
||||
`echo "
|
||||
# subroutine used to run postscripts
|
||||
run_ps () {
|
||||
logdir=\\"/var/log/xcat\\"
|
||||
\\\`mkdir -p \\\$logdir\\\`
|
||||
logfile=\\"/var/log/xcat/xcat.log\\"
|
||||
|
||||
if [[ -f \\\$1 ]]; then
|
||||
echo \\"Running postscript: \\\$1\\"
|
||||
print $::LOG_FILE "$::sdate xcataixpost: Running postscript: $1\n";
|
||||
OUTPUT=\\\`./\\\$1 2>&1\\\`
|
||||
if [[ -n \\\$OUTPUT ]]; then
|
||||
echo \\"\\\$OUTPUT\\"
|
||||
print $::LOG_FILE "$::sdate xcataixpost: output=$output\n";
|
||||
echo \\"Postscript \\\$1: \\\$OUTPUT\\" >> \\\$logfile
|
||||
fi
|
||||
else
|
||||
echo \\"Postscript \\\$1 does NOT exist.\\"
|
||||
print $::LOG_FILE "$::sdate xcataixpost: $1 does NOT exist.\n";
|
||||
echo \\"Postscript \\\$1 does NOT exist.\\" >> \\\$logfile
|
||||
fi
|
||||
}
|
||||
# subroutine end
|
||||
|
@ -308,15 +308,21 @@ fi
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript`
|
||||
echo "
|
||||
# subroutine used to run postscripts
|
||||
run_ps () {
|
||||
run_ps () {
|
||||
logdir=\"var/log/xcat\"
|
||||
\`mkdir -p \$logdir\`
|
||||
logfile=\"var/log/xcat/xcat.log\"
|
||||
|
||||
if [[ -f \$1 ]]; then
|
||||
echo \"Running postscript: \$1\"
|
||||
OUTPUT=\`./\$1 2>&1\`
|
||||
if [[ -n \$OUTPUT ]]; then
|
||||
echo \"\$OUTPUT\"
|
||||
echo \"Postscript \$1: $OUTPUT\"\ >> \$logfile
|
||||
fi
|
||||
else
|
||||
echo \"Postscript \$1 does NOT exist.\"
|
||||
echo \"Postscript \$1 does NOT exist.\" >> \$logfile
|
||||
fi
|
||||
}
|
||||
# subroutine end
|
||||
|
Loading…
Reference in New Issue
Block a user