Contents |
rsync -avHl /var/named/ /home/named.backup/
sed -i -e "s/TTL\ 14400/TTL\ 600/" /var/named/*.db
newserial=$(date +%Y%m%d%H); sed -i -e "s/[0-9]\{10\}/$newserial/" /var/named/*.db
rndc reload
Copy over key:
ssh-keygen -t rsa cat /root/.ssh/id_rsa.pub | ssh root<newhost> 'read key ; mkdir -p ~/.ssh ; echo "$key" >> ~/.ssh/authorized_keys'
Note:
Cpanel backups do not preserve the same IPs or SSL certs, any SSL accounts will need to be restored separately onto their own IPs.
unalias ls for i in $(ls -A /var/cpanel/users/);do /scripts/pkgacct --skiphomedir $i;done
If you want to split the packaging process run this:
for i in $(ls -A /var/cpanel/users/[a-j]*| cut -d "/" -f 5);do /scripts/pkgacct $i;done for i in $(ls -A /var/cpanel/users/[k-z]*| cut -d "/" -f 5);do /scripts/pkgacct $i;done
cd /home unalias ls for x in $(ls -A *.tar.gz | cut -d "-" -f 2 | cut -d "." -f 1); do /scripts/restorepkg $x; done
for service in crond exim httpd mysql cpanel courier-imap courier-authlib named pure-ftpd proftpd; do /etc/init.d/$service stop; done
Put up maintenance page:
cd /usr/local/apache/htdocs
index.html contents:
cat << EOF > index.html <html> This site is currently performing maintenance. Please check back later. </html> EOF
Start up new http server:
cd /usr/local/apache/conf cp httpd.conf httpd.conf.backup wget -O httpd.conf http://watters.ws/rpms/httpd-std.conf service httpd restart
Migrate only certain accounts:
while read domain; do ACCT=$(grep -l DNS=$domain /var/cpanel/users/*); /scripts/pkgacct `basename $ACCT`; done < domains_to_move.txt while read domain; do ACCT=$(grep -l DNS=$domain /var/cpanel/users/*); echo $domain `basename $ACCT`; done < domains_to_move.txt
FTP files:
ncftpget -R -u user -p pass host_name . public_html/ wget -c -r -nH ftp://user:pass@host.net:/
lftp: set ftp:ssl-allow no mirror . .
oldserver=x.x.x.x
unalias ls
for acct in $(ls -A /var/cpanel/users); do rsync -avzHl -e "ssh -c arcfour" --delete root@${oldserver}:/home/$acct/ /home/$acct/; done
for db in $(mysql -Bse 'show databases' | grep -v information_schema); do ssh ${oldserver} "mysqldump --opt $db" | mysql $db; done
push method:
for acct in $(ls -A /var/cpanel/users); do rsync -avzHl -e ssh /home/$acct/ root@$newserver:/home/$acct/; done
for db in $(mysql -Bse 'show databases' | grep -v information_schema); do mysqldump --add-drop-database --databases $db | ssh $newserver "mysql"; done