1
0
Fork 0
knowledge-base/KB/Linux/Server/unbound/scripts/unbound_update_root_hints

24 lines
No EOL
544 B
Bash

#!/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;