diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2012-02-09 11:12:09 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2012-02-20 22:00:12 +0530 |
commit | f90a39b875921fcd18ee80857ec2eb29daea9c76 (patch) | |
tree | 7d72471960af6d2d56d915deb6f19946dc13a8bf /arequal/arequal-run.sh | |
parent | 160b798aad17c48e2bf93811dd06de168244a4e1 (diff) |
c_pgms/arequal: Add arequal tool to the git
Adding arequal to the git, which can be used to calculate the checksum
of path given to it as an argument
Change-Id: Iefd283511e6ff2f3bc1359e718d1922506d7a24a
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Diffstat (limited to 'arequal/arequal-run.sh')
-rwxr-xr-x | arequal/arequal-run.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/arequal/arequal-run.sh b/arequal/arequal-run.sh new file mode 100755 index 0000000..597cf26 --- /dev/null +++ b/arequal/arequal-run.sh @@ -0,0 +1,45 @@ +#!/bin/bash + + + +function do_copy() +{ + local src="$1"; + local dst="$2"; + + rsync -avz $src $dst; +} + + +function calc_checksum() +{ + local dir="$1"; + + echo "Calculating checksum on directory $dir ..." + arequal-checksum "$dir"; + echo "-------------------------------------" + echo +} + + +function main() +{ + local src="$1"; + local dst="$2"; + + if [ $# -ne 2 ]; then + echo "Usage: $0 <src> <dst>"; + echo " e.g: $0 /usr /mnt/glusterfs/usr"; + fi + + do_copy "$src" "$dst"; + + echo "Calculating checksums on source and destination"; + echo "==============================================="; + + calc_checksum "$src"; + + calc_checksum "$dst"; +} + +main "$@" |