This is made with Python Fabric but can easily be modified to be used for other systems. How it works:
from fabric import Connection, task
HOST_0 = "user@321.123.321.123"
FOLDER_0 "/home/user0/folder_to_check"
HOST_1 = "user@123.321.123.321"
FOLDER_1 "/home/user1/folder_to_check"
def get_checksum(c, folder, dst):
c.run("rm checksum.txt || true")
c.run("cd " + folder + "&& find . -maxdepth 100 -type f -exec md5sum {} \; >> $HOME/checksum.txt") # noqa c.get("checksum.txt", dst)
@task
def checksum(c):
get_checksum(
Connection(HOST_0),
FOLDER_0,
"/tmp/checksum-0.txt",
)
get_checksum(
Connection(HOST_1),
FOLDER_1,
"/tmp/checksum-1.txt",
)
c.run("diff /tmp/checksum-0.txt /tmp/checksum-1.txt")
You can easily replace md5sum with sha1sum for less collisions, but in most practice this is not needed.