Update mail command for git statuses.
This commit is contained in:
parent
561c17292e
commit
95972c6d3b
1 changed files with 13 additions and 3 deletions
|
|
@ -1,8 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Default configuration.
|
||||
CHECK_DIRS=('/')
|
||||
EMAIL_TO=('sysadmin@slackware.uk')
|
||||
EMAIL_FROM="${HOSTNAME%%.*} <noreply@slackware.uk>"
|
||||
EMAIL_FROM="\"Server: ${HOSTNAME%%.*}\" <noreply@slackware.uk>"
|
||||
|
||||
# Allow /etc/default/warn-git-status to override default configuration.
|
||||
[[ -e /etc/default/warn-git-status ]] && {
|
||||
source /etc/default/warn-git-status || {
|
||||
printf "%s: %s\\n" "${0##*/}" "failed reading /etc/default/warn-git-status" >&2
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
OUTPUT_FILE="/tmp/${0##*/}-$$-$RANDOM"
|
||||
|
||||
# Remove the OUTPUT_FILE when done.
|
||||
|
|
@ -22,8 +32,8 @@ done
|
|||
|
||||
# Send the message.
|
||||
if [[ -n "${EMAIL_TO[*]}" ]]; then
|
||||
mailx "${MAILX_ARGS[@]}" -S "from=$EMAIL_FROM" -s "Git statuses" "${EMAIL_TO[@]}" <<<"$(cat "$OUTPUT_FILE")" 2>/dev/null || {
|
||||
printf "%s: %s\\n" "${0##*/}" "mailx command failed" >&2
|
||||
mail -r "$EMAIL_FROM" -s "Git statuses" "${EMAIL_TO[@]}" <"$OUTPUT_FILE" >/dev/null 2>&1 || {
|
||||
printf "%s: %s\\n" "${0##*/}" "mail command failed" >&2
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue