2022-09-04 12:54:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
hostname=$(hostname)
|
2022-09-04 13:16:19 +00:00
|
|
|
mail_from="alias@domain.tld";
|
|
|
|
mail_to="alias@domain.tld";
|
2022-09-04 12:54:22 +00:00
|
|
|
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;
|