DreamHost PS migration Tips
Posted by: askapache
Posted on: 2008-05-31 14:26:00
I've recently relocated to the DreamHost private server setup, not for any reason other than its such a cool offer by DH, albeit pretty darn expensive compared to the shared hosting setup. Here are some problems I experienced and the solutions.
No crontabs or cronjobs
None of my crontab files were moved to my new server and in fact I was receiving permission denied just to access my crontab.
Solution
I contacted support and they installed new crontabs for me and offered to copy my old ones.
Static IP Changed for site with non-DreamHost DNS
For the most part this didn't cause to many errors. But one site uses DNS from a different provider, so my site was down until I updated the DNS with that provider. It would have been nice and should be expected that in this situation DreamHost would alert you that the change is going to happen so you can update your DNS.
References to old server and old static IP's not updated
Some of my sites and user accounts use passwordless SSH to make some things work, and all of these were broken until I made new keys and set them all up.
I have some pretty technical and complex sites, cgi's, and .htaccess setups on some of my sites, and many of my files contain code to use ssh or scp to login to another user account on a different server. And some of my files contain references to the Static IP and/or dreamhost server. When both the Static IP and dreamhost server changed it broke all my files. The solution I came up with was I wrote a simple shell script that I can run from the root of my user account using SSH that searches all of my sites files for references to my old Static IP and old dreamhost server and 1 by 1 asks me if I'd like to replace them with the newer IP and dreamhost server.
#!/bin/bash
shopt -s extglob
renice 19 $$
OLDSERVER=208.113.183.103
NEWSERVER=208.113.134.190
FIXFILES=$(grep -R -l -i $OLDSERVER $HOME/!(Maildir|logs|backups|source|tmp|doit|php5|php526|ip_abuse) 2>/dev/null)
for thefile in ${FIXFILES[@]}; do
if [ -f "$thefile" ]; then
echo -e "\n\n\n\n"
echo "___________________________________________________________________"
echo "Name: ${thefile}"
echo "Type: $(command file -b ${thefile})"
echo "Size: $(command du -hs ${thefile}|awk '{ print $1}')"
echo "Matching Lines:"
grep -i --color=auto $OLDSERVER $thefile
echo -e "___________________________________________________________________\n"
echo -en "Replace occurances of $OLDSERVER with $NEWSERVER? [y/N] " ; read -n 1 ans
case "$ans" in
n|N) echo -e "\nSKIPPING..."; ;;
y|Y) echo -e "\nREPLACING..."
cp $thefile $thefile.b1 &>/dev/null
cat $thefile.b1 | sed "s/${OLDSERVER}/${NEWSERVER}/g" 1>$thefile
rm $thefile.b1 &>/dev/null
echo "DONE"; ;;
esac
fi
done
exit 0
Due to the limitations of the forum, I published a more complete DreamHostPS Migration Tips on my blog.
_____ _ _| _ _ _ _|_ _
(_|_\|<(_||_)(_|(_| |(/_
|