dataset-file-chek/dataset-diff.sh

34 lines
734 B
Bash
Raw Normal View History

#!/bin/bash
uuid=$1
if [ $# -ne 1 ]
then
echo "Usage: $0 {DATA_UUID}"
exit 1
fi
rm $uuid-db.txt $uuid-fs.txt Diff.html
php -f dataset-files.php $uuid
datapath=`head -1 $uuid-db.txt`
echo $datapath >> $uuid-fs.txt
fcount=`find -L "$datapath"/* | wc -l`
curpath=`pwd`
if [ $fcount -gt 0 ]; then
cd $datapath
find . -printf "%p %s\n" | grep -v '^\./ 4096$\|^\. 4096$' | sort >> $curpath/$uuid-fs.txt
else
echo $datapath;
fi
cd $curpath
2015-05-21 15:00:44 +00:00
sed '1d' $uuid-db.txt | sort > tmp
echo $datapath > $uuid-db.txt
cat tmp >> $uuid-db.txt
rm tmp
if ! diff -q $uuid-db.txt $uuid-fs.txt > /dev/null; then
vimdiff -c ":TOhtml | :wq | :q | :q" $uuid-db.txt $uuid-fs.txt
cp Diff.html /var/www/ftp2.westgis.ac.cn/diff/$uuid-diff.html
fi
exit 0