Mobile app version of vmapp.org
Login or Join
Bryan171

: Tool for running a diff against production and test servers? We're about to have a major site infrastructure migration (new OS, upgraded PHP, etc). We currently have a live test mirror of the

@Bryan171

Posted in: #Migration #Testing #Tools

We're about to have a major site infrastructure migration (new OS, upgraded PHP, etc).

We currently have a live test mirror of the new environment running, using the production file system.

We're expecting there to be some issues due to both the version change in PHP (let's just say PHP was very out of date on the old server and leave it at that) and changes in environment variables. Are there any good automated tools to quickly spider both sites so we can pinpoint issues faster than manually checking each page? I've already found a few manually, but anything which can double check in an automated fashion--especially across the entire site--would be lovely. I've searched around a bit but haven't found anything that seems to fit what we need. Maybe I'm just running the wrong keywords.

Multi step processes would be fine too, like spidering the site with a batch script/mass downloader and then running a folder diff. I'm coding from a windows environment but 'nix tools are fine too.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Bryan171

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

Its pretty easy to do with a little bit of shell scripting. Here is a script uses bash, wget, and diff to download two urls (specified on the command line) and print out the differences.

#!/bin/bash
set -e
url1=
url2=
if [[ "$url1" != http* ]]
then
echo "Bad url: $url1"
fi
if [[ "$url2" != http* ]]
then
echo "Bad url: $url2"
fi
file1=`wget -x $url1 2>&1 | grep 'Saving to' | sed "s/^Saving to: .//g;s/.$//g"`
file2=`wget -x $url2 2>&1 | grep 'Saving to' | sed "s/^Saving to: .//g;s/.$//g"`
diff -u $file1 $file2


You could call this with a list of pages on the site.

Alternately, you could use wget to download both sites entirely and then do a diff of the entire directory structure created.

wget -rx old.example.com/ wget -rx new.example.com/ diff -u old.example.com new.example.com


I tested this on a machine running Ubuntu Linux. It should be trivial to get to work on other Linux variants. You much just have to install wget or diff. Under Windows you could run it under Cygwin. Should be able to get it to work under OS X as well, but I don't know the details.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme