Remote diff

Posted by Paul on April 29, 2008 in Uncategorized |

I just had a problem to solve: Compare two server config files on two servers to make sure they’re the same. Rather than using scp to copy the file from one machine to another, I used ssh’s ability to run commands remotely to get the contents of the file and piped it into diff. Here’s an example:

ssh user@server1 'cat /path/to/config/file.conf' | diff /path/to/other/config/file.conf -


I’ll leave it as an exercise for the user to write a shell script that will do this automatically, though it should be fairly easy to do.

Tags: , , , , ,

1 Comment

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2003-2012 Move to Iceland All rights reserved.
Desk Mess Mirrored v1.8.3 theme from BuyNowShop.com.