How to restore a crashed directadmin server

Please follow the procedure to restore a crashed directadmin server. It is based on Centos.

1) Install direactadmin and configure apache, php, mysql with same version/settings as in old server

2) Mount the old HDD under /old . If you have /home or any other partition in old server , please mount it under /old/

#!/bin/bash
cp -avprf  /old/etc/passwd  /etc/
cp -avprf  /old/etc/group /etc/
cp -avprf  /old/etc/shadow /etc/
cp -avprf  /old/etc/gshadow /etc/
cp -avprf  /old/etc/my.cnf /etc/
cp -avprf  /old/etc/exim*  /etc/
cp -avprf  /old/etc/hosts  /etc/
cp -avprf  /old/etc/httpd/conf/* /etc/httpd/conf/
cp -avprf  /old/etc/named.conf /etc/
cp -avprf  /old/etc/proftpd.conf /etc/
cp -avprf  /old/etc/proftpd.passwd /etc/
cp -avprf  /old/etc/proftpd.vhosts.conf /etc/
cp -avprf  /old/etc/resolv.conf /etc/
cp -avprf  /old/etc/system_filter.exim  /etc/

cp -avprf  /old/usr/local/directadmin/conf  /usr/local/directadmin/
cp -avprf /old/usr/local/directadmin/plugins /usr/local/directadmin/
cp -avprf /old/etc/mail  /etc/
cp -avprf /old/etc/virtual /etc/
cp -avprf  /old/var/named /var/
cp -avprf  /old/var/spool/cron /var/spool/
cp -avprf  /old/var/spool/virtual /var/spool/
cp -avprf  /old/var/www /var/
cp -avprf  /old/usr/local/directadmin/data /usr/local/directadmin/

cp -avprf /old/var/lib/mysql  /var/lib/
cp -avprf /old/home/*  /home/

3) Now compile apache and php using the directadmin custom build script

4) Test your websites