Many small updates to various scripts.
deleted: cronjob-update-packages-list.new deleted: cronjob-updatedb-mirrors renamed: rsync-notify-upload -> notify-rsync-upload modified: colour-changelog modified: cronjob-clean-php modified: cronjob-dehydrated modified: cronjob-fix-log-acls modified: cronjob-rotate-logs-today-symlink modified: cronjob-update-mirrors-search-db modified: cronjob-update-packages-list modified: cronjob-warn-git-status modified: cronjob-warn-smtp-queue modified: do-backup modified: dovecot-service-checksuspended modified: firewall-initscript modified: git-auto-merge modified: mirror modified: mirror-new-slackware-release.gpg modified: mirror-wrapper modified: notify-rsync-upload modified: sbosrcarch-wrapper
This commit is contained in:
parent
500b36e5f8
commit
041ebf1b1a
21 changed files with 83 additions and 181 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#!/bin/bash
|
||||
# Send an email with the status of the SMTP queue on the system.
|
||||
|
||||
# Default configuration.
|
||||
# This can be overridden in /etc/default/warn-smtp-queue.
|
||||
EMAIL_TO=('sysadmin@slackware.uk')
|
||||
EMAIL_FROM="\"Server: ${HOSTNAME%%.*}\" <noreply@slackware.uk>"
|
||||
|
||||
|
|
@ -24,23 +26,13 @@ hash mailq 2>/dev/null && {
|
|||
[[ -z "$TMP_OUTPUT" ]] && exit 0
|
||||
|
||||
# Send the message.
|
||||
if [[ -n "${EMAIL_TO[*]}" ]]; then
|
||||
if hash mailx >/dev/null 2>&1; then
|
||||
mailx -S "from=$EMAIL_FROM" -s "Mail queue" "${EMAIL_TO[@]}" <<<"$TMP_OUTPUT" 2>/dev/null || {
|
||||
printf "%s: %s\\n" "${0##*/}" "mailx command failed" >&2
|
||||
exit 1
|
||||
}
|
||||
elif hash mail >/dev/null 2>&1; then
|
||||
mail -r "$EMAIL_FROM" -s "Mail queue" "${EMAIL_TO[@]}" <<<"$TMP_OUTPUT" 2>/dev/null || {
|
||||
printf "%s: %s\\n" "${0##*/}" "mail command failed" >&2
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
printf "%s: %s\\n" "${0##*/}" "no mailer command found" >&2
|
||||
if [[ -n "$EMAIL_FROM" ]] && [[ -n "${EMAIL_TO[*]}" ]]; then
|
||||
mail -r "$EMAIL_FROM" -s "Mail queue" "${EMAIL_TO[@]}" <<<"$TMP_OUTPUT" >/dev/null 2>&1 || {
|
||||
printf "%s: %s\\n" "${0##*/}" "mail command failed" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
else
|
||||
printf "%s: %s\\n" "${0##*/}" "no recipient configured for mail delivery" >&2
|
||||
printf "%s: %s\\n" "${0##*/}" "no sender and/or recipient configured for mail delivery" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue