Accueil > Système > Diff à distance

Diff à distance

16/01/2024 Categories: Système Tags: , , ,
Print Friendly, PDF & Email

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:  Debian Linux apt-get package management cheat sheet
Categories: Système Tags: , , ,
Les commentaires sont fermés.