Skip to content

Instantly share code, notes, and snippets.

@pboothe
Created December 8, 2016 16:47
Show Gist options
  • Save pboothe/c107c9552647e41ab554ed39f75ed22c to your computer and use it in GitHub Desktop.
Save pboothe/c107c9552647e41ab554ed39f75ed22c to your computer and use it in GitHub Desktop.
did_they_come_back() {
echo "#### Starting did_they_come_back() ####"
#TODO: Make this take out bad entries from $REBOOT_CANDIDATES
for line in `cat "${REBOOT_ATTEMPTED}"`; do
attempted_host=`echo $line | awk -F: '{ print $1 }'`
if grep -q "${attempted_host}" "${REBOOT_CANDIDATES}" ; then
echo "${attempted_host} still not up but requested during last run:" \
$line |tee -a ${PROBLEMATIC} "${NOTIFICATION_EMAIL}" > /dev/null
else
echo $line >> "${REBOOT_LOG}"
fi
done
rm -f ${REBOOT_CANDIDATES}.tmp
touch ${REBOOT_CANDIDATES}.tmp
for candidate in `cat "${REBOOT_CANDIDATES}"`; do
if grep -q $candidate "${REBOOT_ATTEMPTED}" ; then
echo "$candidate still not up but requested during last run:" \
$line |tee -a ${PROBLEMATIC} "${NOTIFICATION_EMAIL}" > /dev/null
else
echo $candidate >> ${REBOOT_CANDIDATES}.tmp
fi
done
mv ${REBOOT_CANDIDATES}.tmp ${REBOOT_CANDIDATES}
# Write this backwards, so that if a line in reboot candidates is also found in
# REBOOT_ATTEMPTED, then write it out to problematic?
# TODO: Is it ok to leave it on the REBOOT_CANDIDATES list to try again, even
# if it didn't come back right from the last run?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment