Commit 04a17d6e authored by Dan Reading's avatar Dan Reading
Browse files

stuff for cron job

parent d9996bc2
...@@ -486,13 +486,16 @@ setdirstructure() { ...@@ -486,13 +486,16 @@ setdirstructure() {
genreport_main() { genreport_main() {
reporting=1 reporting=1
[[ -z "${CHECKNODE_CRONJOB-}" ]] && declare CHECKNODE_CRONJOB="NO"
[[ -z "${RUNNING_FROM_CRON-}" ]] && declare RUNNING_FROM_CRON="NO" [[ -z "${CHECKNODE_MTA-}" ]] && declare CHECKNODE_MTA="sendmail -t"
[[ -z "${CHECKNODE_MAILTO-}" ]] && declare CHECKNODE_MAILTO=""
if [ "${RUNNING_FROM_CRON}" != "NO" ] ; then if [ "${CHECKNODE_CRONJOB}" != "NO" ] ; then
# if MAILTO is empty then switch to cat-ing the info, cron can do with it what is wants
# i.e. use the standard cron MAILTO var
[[ -z "${CHECKNODE_MAILTO}" ]] && CHECKNODE_MTA="cat"
echo "Subject: CheckNode report for $(hostname)" > /tmp/Report_CheckNode echo "Subject: CheckNode report for $(hostname)" > /tmp/Report_CheckNode
echo "From: CheckNode" >> /tmp/Report_CheckNode echo "From: CheckNode" >> /tmp/Report_CheckNode
echo "To: dreading@flux.utah.edu" >> /tmp/Report_CheckNode echo "To: ${CHECKNODE_MAILTO}" >> /tmp/Report_CheckNode
else else
echo "" > /tmp/Report_CheckNode echo "" > /tmp/Report_CheckNode
fi fi
...@@ -522,11 +525,12 @@ genreport_main() { ...@@ -522,11 +525,12 @@ genreport_main() {
rm -f /tmp/genreport /tmp/driftreport rm -f /tmp/genreport /tmp/driftreport
done done
if [ "${RUNNING_FROM_CRON}" != "NO" ] ; then if [ "${CHECKNODE_CRONJOB}" != "NO" ] ; then
cat /tmp/Report_CheckNode | sendmail -t cat /tmp/Report_CheckNode | ${CHECKNODE_MTA}
else else
cat /tmp/Report_CheckNode cat /tmp/Report_CheckNode
fi fi
rm -f /tmp/Report_CheckNode
} }
# start here # start here
......
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