system-helpers/usr/local/bin/smartdnotify

15 lines
No EOL
405 B
Bash
Executable file

#!/usr/bin/env bash
check_required() {
type hostname &> /dev/null || { echo "Requiring 'hostname' but it's not installed"; exit 1; }
type wall &> /dev/null || { echo "Requiring 'wall' but it's not installed"; exit 1; }
}
check_required
HOSTNAME=$(hostname)
SUBJECT="[smartd $HOSTNAME] $SMARTD_FAILTYPE"
MESSAGE=$(echo -e "$SMARTD_MESSAGE")
notifier "${SUBJECT}" "${MESSAGE}"
wall "$SMARTD_MESSAGE"