Home > bash, coding, cygwin, debian, linux, mac os > Compare two Tomcat installations using rsync

Compare two Tomcat installations using rsync

Lets assume you manage multiple servers that host Java web applications using the Tomcat web server.

To quickly compare the Tomcat installations on host1 and host2, we can use the “dry-run” mode of the rsync command.

In the following example, we assume that you have ssh access to both of your Tomcat hosts, the installations are in /opt/tomcat and the “tomcat” system user has read access to all relevant files and directories of the installation:

ssh tomcat@host1
rsync --archive --checksum --dry-run --verbose --delete \
      --exclude temp --exclude work --exclude logs --exclude webapps \
      /opt/tomcat/ tomcat@host2:/opt/tomcat/

This will list

  • All files that differ in checksum
  • All files that only exist on host2 (look for ‘deleting [filename]’)

Run the same commands with host1 and host2 switched, to also see the files that only exist on host1.

We excluded the temp, work and logs directories because they are variable in nature.
We also excluded the webapps directory because we only wanted to compare the base installation.

Advertisements
Categories: bash, coding, cygwin, debian, linux, mac os
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: