Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Plesk, DNS Bulk Apply Settings
ADMIN_PASS=`cat /etc/psa/.psa.shadow`
MYSQL_BIN_D=`grep MYSQL_BIN_D /etc/psa/psa.conf | awk '{print $2}'`
PRODUCT_ROOT_D=`grep PRODUCT_ROOT_D /etc/psa/psa.conf | awk '{print $2}'`
mysql="${MYSQL_BIN_D}/mysql -N -uadmin -p${ADMIN_PASS} psa"
query="select name from domains;"
domains=`echo $query | $mysql `
for i in ${domains}; do
${PRODUCT_ROOT_D}/bin/dns --off $i
${PRODUCT_ROOT_D}/bin/dns --on $i
Copy link

h9k commented Sep 5, 2016

SELECT name FROM dns_zone WHERE id > 1 AND status = 0

Might be a more reliable query, as you don't want to re-enable DNS for domains for which it was disabled already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment