Accueil > Système > Diff à distance

Diff à distance

12/03/2021 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.


Lire aussi:  BASH : Suppression des accents, cédilles, etc
Categories: Système Tags: , , ,
Les commentaires sont fermés.