I created a shell script, so that every day the data from another server with the email lists are imported into the PMG.
So every day a script runs causing the domains to be deleted and re-added in the PMG.
Everything runs correctly, and I'm getting the process I need, but the list is getting bigger every day, and it's taking hours to delete and hours to add.
How could I optimize for the pmgsh call to be unique, without making it open its own shell?
So every day a script runs causing the domains to be deleted and re-added in the PMG.
Code:
echo "Clearing current Blacklist of incoming emails"
pmgsh get /config/ruledb/who/83/objects | sort |grep id | cut -d : -f 2- | sed 's/[ \t]*//;s/[ \t]*"//' | sed 's/[ \t]*//;s/[ \t]*"//' | sed 's/[ \t]*//;s/[ \t]*,//' > /tmp/del_list
for DEL in `cat /tmp/del_list`; do pmgsh delete /config/ruledb/who/83/objects/$DEL; done >/dev/null 2>&1
echo "Importing Blacklist of Incoming Emails to PMG"
while read blacklist ; do pmgsh create /config/ruledb/who/83/email --email "$blacklist" ; done < /tmp/pmg_blacklist_emails >/dev/null 2>&1
Everything runs correctly, and I'm getting the process I need, but the list is getting bigger every day, and it's taking hours to delete and hours to add.
How could I optimize for the pmgsh call to be unique, without making it open its own shell?