How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

March 31, 2008

Move all account from one server to another

Filed under: Linux — admin @ 2:19 pm

First of all, 24 hours before the transition, change all dns zones from TTL 14400 to TTL 180, to make dns changes go faster…

You can change all of the DNS zone files by running the following command
root@pilot [/var/named]# perl -pi.bak -e “s/14400/180/g” *.db
That is run within the directory you store the zone files.
And don´t forget to run
# rndc reload
After doing this.

Copy all account from old server to new one.

Place this script in /usr/local/bin and chmod +x it

#!/bin/bash

#Forwarding By Paul Fleming
#Shouts to #cpanel on efnet

if [ “$UID” != “0” ]; then
echo “You must be root to use this tool”
exit 1
fi

DOWHAT=$1

case $DOWHAT in
‘on’)
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -i eth0 –protocol tcp –destination-port ! 22 -j DNAT –to-destination $2
iptables -t nat -A PREROUTING -i eth0 –protocol udp -j DNAT –to-destination $2
echo “All Ports Excluding Port 22 Forwarded”
echo “Shutting Down Local Services”
service httpd stop
service pure-ftpd stop
service proftpd stop
service cpanel stop
;;
‘off’)
iptables -F
echo “Forwarding Off”
echo “Restarting Services”
service httpd restart
service cpanel restart

;;

*)
# how to use this thing.
echo “example: forward on 12.12.12.12 will enable forwarding to 12.12.12.12”
echo “forward off to disable”
echo “forward by Paul Fleming”
;;

esac

You use it like
forrward on newip

Originaly posted at:http://www.webhostingtalk.com

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress