#!/bin/bash
current_dir=/data/tomcat
des_ip=192.168.2.1
find $current_dir -type f|xargs md5sum > /tmp/md5_current.txt
ssh $des_ip "find $current_dir -type f|xargs md5sum > /tmp/md5_des.txt"
scp $des_ip:/tmp//tmp/md5_des.txt /tmp
for f in `awk '{print 2} /tmp/md5_current.txt'`
do
if grep -qw "$f" /tmp/md5_des.txt
then
md5_a=`grep -w "$f" /tmp/md5_current.txt|awk '{print 1}'`
md5_b=`grep -w "$f" /tmp/md5_des.txt|awk '{print 1}'`
if [ $md5_current != $md5_des ]
then
echo "$f changed."
fi
else
echo "$f deleted."
fi
done
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)