Skip to content

Commit

Permalink
cron: enhance subject of daily run's email
Browse files Browse the repository at this point in the history
  • Loading branch information
rpelisse committed Apr 15, 2024
1 parent 3362071 commit a900743
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions roles/cron/templates/ansible-daily-run.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rm "${ZEUS_STATUS_FILE}"
touch "${ZEUS_STATUS_FILE}"

readonly LOGFILE="$(mktemp)"
echo "Ansible Daily run on Olympus" > "${LOGFILE}"
echo "$(hostname) " > "${LOGFILE}"

zeus_status() {
if [ -s "${ZEUS_STATUS_FILE}" ]; then
Expand All @@ -23,7 +23,7 @@ zeus_status() {
mail_report_and_clean() {
local subject=$(head -1 "${LOGFILE}" | sed -e "s;$; (Status: $(zeus_status));")
cat "${LOGFILE}" | \
mailx -r "{{ mailer.to }}" -s "{{ jobs.name }}:${subject}" \
mailx -r "{{ mailer.to }}" -s "{{ jobs.name }}: ${subject}" \
-S smtp="{{ mailer.smtp.host }}:{{mailer.smtp.port }}" "{{ mailer.replyTo }}"
rm -f "${LOGFILE}"
}
Expand Down

0 comments on commit a900743

Please sign in to comment.