Move data from one web server to another using wget
Recently I needed to move a large amount of data from one web server to another. I was moving about 50 websites to a new server. I didnt want to download all the data via FTP and then upload it to the new server (especially not from here in Honduras where the Internet isnt as fast as I would have liked). I didnt have SSH access to the old server due to shared hosting security issues. How did I move it all in only a few minutes?
I had asked the host for a backup of my home directory which contained the data for all the sites. Due to some annoying permissions problems, the backup they provided me didnt contain all the files (which I discovered as I begun doing the scheduled transfer). The timezone differences meant that while I was working at a comfortable 8am, the time in NZ was around 2am. I couldnt ask for another backup and expect to have it in time, so I had to think of a better way.
Then I remembered wget. An amazing Unix tool that I use very often. I usually only use it for http requests, and had forgotten it could do ftp as well. So while I didnt have SSH access to the old server, I did have FTP access. I used the following wget command to log into FTP and download every single file under my home directory to the new server (which I did have SSH access to as it is a VPS that I own):
wget -r -N -l inf ftp://user:pwd@ftp.example.com/foldername
Within a few minutes (the two servers were both based in Auckland and the transfer speed was incredibly fast) all the data had been transferred across. I only had to re-organise the location of the data to the appropriate places, backup and import the MySQL databases to the new server and wa-la it was done. Thankfully, the 50-odd sites are running on the Frondiz CMS which means that the installation on the new server was very quick (ie, I didnt have to setup 50 different sites in apache, just a few, one that contains lots of domain names).
Related posts:
September 12th, 2008 at 8:12 am
[...] Robert Kern [...]
September 14th, 2008 at 5:49 am
[...] Robert Kern [...]