2015-04-27 15:17:02 +00:00
#!/bin/bash
2015-05-01 12:20:36 +00:00
rm dataset-0.txt dataset-1.txt Diff.html
php -f file-in-db.php
2015-04-27 15:17:02 +00:00
cat dataset-0.txt | while read oneline;
do
uuid = ` echo $oneline | awk '{print $1}' `
datapath = ` echo " $oneline " | awk -F'\t' '{print $4}' `
fcount = ` find -L " $datapath " /* | wc -l`
if [ $fcount -gt 0 ] ; then
volume = ` du -sbL " $datapath " /* | awk '{a+=$1}END{print a}' `
echo -e $uuid '\t' $volume '\t' $fcount '\t' $datapath >> dataset-1.txt
else
echo $datapath ;
fi
done
2015-05-01 12:20:36 +00:00
if ! diff -q dataset-0.txt dataset-1.txt > /dev/null; then
vimdiff -c ":TOhtml | :wq | :q | :q" dataset-0.txt dataset-1.txt
2015-05-21 14:05:47 +00:00
cp Diff.html /var/www/ftp2.westgis.ac.cn/diff.html
2015-05-01 12:20:36 +00:00
echo "FTP2 dataset file has been changed. Please use the attachment to find the differences." | mail -s "FTP2 dataset file change" -A Diff.html wangliangxu@lzb.ac.cn
fi
exit 0