From a96424f86a432b448de242524592ce5673109641 Mon Sep 17 00:00:00 2001 From: wlx Date: Thu, 21 May 2015 21:42:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=9E=E7=8E=B0=20westdc/d?= =?UTF-8?q?ataset-file-check#1=20=EF=BC=8C=E6=9F=A5=E7=9C=8B=E6=9F=90?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84=E5=85=B7=E4=BD=93=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=B7=AE=E5=BC=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dataset-diff.sh | 28 ++++++++++++++++++++++++++++ dataset-files.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 dataset-diff.sh create mode 100644 dataset-files.php diff --git a/dataset-diff.sh b/dataset-diff.sh new file mode 100644 index 0000000..a1bcfa9 --- /dev/null +++ b/dataset-diff.sh @@ -0,0 +1,28 @@ +#!/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' | sort >> $curpath/$uuid-fs.txt +else + echo $datapath; +fi + +cd $curpath +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 diff --git a/dataset-files.php b/dataset-files.php new file mode 100644 index 0000000..fab00ca --- /dev/null +++ b/dataset-files.php @@ -0,0 +1,42 @@ +