Accueil > Système > Diff à distance

Diff à distance

20/05/2023 Categories: Système Tags: , , ,

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.

Source: movetoiceland.com

Lire aussi:  OS X: How to reset the DNS cache
Categories: Système Tags: , , ,
Les commentaires sont fermés.