IT Business Services - Website design - Search Engine Optimisation - System Integrations - Internet Advertising - PC Desktop Networking
About Portfolio


Hansen IT Solutions can provide a range of services.

Website development and ongoing maintenance

Search engine optimisation

Social media integration and management

SMB Desktop networking design, services and support

Internet connectivity

VoIP Telephony including PABX systems and integration

Custom programming services

Adding slave DNS servers for Plesk

There is a nice and simple extension for Plesk that allows you to setup slave DNS zones from Plesk domains automatically.

If your adding this to an existing server though its a little hit and miss if it will add existing domains. The instructions say you can do this via ‘Apply DNS template’ but this did not work for me. Adding new domains worked fine though.

I ended up writing this script and it worked great.

/usr/sbin/rndc -c /usr/local/psa/var/modules/slave-dns-manager/slave_*SLAVEIP*>.conf addzone $1 '{ type slave; file "db.'$1'"; masters { *MASTERIP*; }; };'

Replace *MASTERIP* and *SLAVEIP* with your own server IPs.

Usage from the command line is just needs a the DNS your setting up the slave with as the parameter

Taking it further there was a few hundred domains which didnt seem fun to type in one at a time so I used this script to loop over all the domains and add each one.


ADMIN_PASS=`cat /etc/psa/.psa.shadow`
MYSQL_BIN_D=`grep MYSQL_BIN_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
./add-slave.sh $i

from https://gist.github.com/agarzon/37b6eac3f31a5017ffb2 which was linked in the comments.

WHMCS and Plesk 12

If you are having problems, such as randomly not loading pages, running WHMCS on otherwise stock Plesk 12 server, try updating the install of ioncube. It seems the version installed with Plesk is a little older and doesnt quite work right with the current version of WHMCS.

Rsync backup CentOS server with email report

Running various business critical CentOS based Linux servers means good backups are a must. The ability to restore completely from backup to a DR site is a must.

To do this I keep a copy of the server backed up at root level on a locally hosted NAS.

A nightly rsync runs, with appropriate exlucsions that keeps a local copy of the system in sync. Data usage on the various Web/DNS/email servers I run works out to be around 50-200mb a night.

rm -f /var/log/sync/*

rsync -avzh –delete –stats server1.com:/  /store/backup/server1/ >/var/log/sync/server1 –exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs,usage/*}

tail /var/log/sync/* | mail -s “Server sync report”[email protected]

add a rsync line for each server.

the rsync logs are kept in /var/log/sync. To know if it was a success I can monitor the email. As I’m really only interested in success/fail i use tail to only show me the last few lines of each log.

To restore, do a minimal install of the same CentOS version, install rsync, and rsync directly over root from the backup. Reboot to bring the new system back online as per the last backup.

Get in contact with us