#!/bin/bash hostname=$(hostname) mail_from="monitoring@myservermanager.com"; mail_to="monitoring@myservermanager.com"; mail_enabled="true" # action wget ftp://FTP.INTERNIC.NET/domain/named.cache -O /etc/unbound/root.hints; res=$?; if [ $mail_enabled == 'true' ]; then resText="Successfully updated"; if [ $res != 0 ]; then resText="Failed to update" fi SUBJECT="[$hostname] ${resText} unbound root.hints"; CONTENTS="${resText} unbound root.hints."; echo "${CONTENTS}" | mailx -Ssendwait -s "${SUBJECT}" $mail_to; fi exit $res;