|
Directory : /scripts2/ |
#!/bin/bash
# Notify of undesirable cPanel Default Address settings for emails. Expected result is ":fail:".
# This script is DEPRECATED, it was authomatized with correct_defaddr.sh and list_defaddr_fwd.sh.
HOSTNAME=$(hostname)
EMAIL="sysadmin@sitioshispanos.com"
INFRACTORS=$(mktemp)
WANTED=":fail:"
whmapi1 --output=jsonpretty listaccts |
jq -r .data.acct[].user |
while read -r acc; do
uapi --output=json --user="$acc" Email list_default_address user="$acc" |
jq -r .result.data[].defaultaddress |
while read -r opt; do
if [[ "$opt" =~ "$WANTED" ]]; then
break
fi
echo "$acc" >> $INFRACTORS
done
done
if [ -s "$INFRACTORS" ]; then
cat $INFRACTORS | mail -s "Accounts with improper Default Address settings at $HOSTNAME" $EMAIL
fi