Finish adding the backup scripts.
This commit is contained in:
parent
837d75d003
commit
dbffec2c4a
@ -12,7 +12,7 @@ else
|
||||
fi
|
||||
echo "Source Backup disk name: $1";
|
||||
echo "Target Backup disk name: $2";
|
||||
echo "Sync storage disk root path: $ssrc";
|
||||
echo "Storage disk root path: $ssrc";
|
||||
echo "Press Enter to Start...";
|
||||
read;
|
||||
echo "Copying...";
|
||||
|
@ -12,7 +12,7 @@ else
|
||||
fi
|
||||
echo "Source Backup disk name: $1";
|
||||
echo "Target Backup disk name: $2";
|
||||
echo "Sync storage disk root path: $ssrc";
|
||||
echo "Storage disk root path: $ssrc";
|
||||
echo "Press Enter to Start...";
|
||||
read;
|
||||
echo "Moving...";
|
||||
|
@ -11,7 +11,7 @@ else
|
||||
ssrc="$2";
|
||||
fi
|
||||
echo "Source Backup disk name: $1";
|
||||
echo "Sync storage disk root path: $ssrc";
|
||||
echo "Storage disk root path: $ssrc";
|
||||
echo "Press Enter to Start...";
|
||||
read;
|
||||
echo "Deleting...";
|
||||
|
@ -17,7 +17,7 @@ if [ $? -ne 0 ]; then
|
||||
echo "Hashes do not match!";
|
||||
exit 1;
|
||||
fi
|
||||
(sha512sum "/mnt/tabls/$1.tbl" > "/tmp/a/$1.tbl.sum") && dd "if=/tmp/a/$1.tbl.sum" bs=128 count=1 "of=/mnt/hsums/$1-tbl.hash";
|
||||
(sha512sum "/mnt/tabls/$1.tbl" > "/tmp/a/$1.tbl.sum") && dd "if=/tmp/a/$1.tbl.sum" bs=128 count=1 "of=/tmp/a/$1-tbl.hash";
|
||||
cmp -s "/tmp/a/$1-tbl.hash" "/mnt/hsums/$1-tbl.hash";
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Partition hashes do not match!";
|
||||
|
30
backup-image/sync-all.sh
Executable file
30
backup-image/sync-all.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#/bin/bash
|
||||
echo "Sync All Backups!";
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: sync-all.sh <Target disk root path> [Source disk root path]";
|
||||
exit 2;
|
||||
fi
|
||||
ssrc="";
|
||||
if [ -z $2 ]; then
|
||||
ssrc="/mnt";
|
||||
else
|
||||
ssrc="$2";
|
||||
fi
|
||||
echo "Target disk root path: $1";
|
||||
echo "Source disk root path: $ssrc";
|
||||
if [[ "$3" != "ikwid" ]]; then
|
||||
echo "Press Enter to Start...";
|
||||
read;
|
||||
fi
|
||||
rval=0;
|
||||
for cf in $ssrc/tabls/*; do
|
||||
if [ -e "$cf" ] && [ -f "$cf" ]; then
|
||||
./sync.sh $(basename "$cf" ".tbl") "$1" "$ssrc" "ikwid";
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Sync failed: $cf";
|
||||
rval=1;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "Finished!";
|
||||
exit $rval;
|
@ -13,15 +13,31 @@ fi
|
||||
echo "Source Backup disk name: $1";
|
||||
echo "Sync target disk root path: $2";
|
||||
echo "Sync source disk root path: $ssrc";
|
||||
echo "Press Enter to Start...";
|
||||
read;
|
||||
if [[ "$4" != "ikwid" ]]; then
|
||||
echo "Press Enter to Start...";
|
||||
read;
|
||||
fi
|
||||
mkdir -p /tmp/a;
|
||||
echo "Syncing...";
|
||||
cp -f "$ssrc/hsums/$1-gz.hash" "$2/hsums/$1-gz.hash";
|
||||
cp -f "$ssrc/hsums/$1-tbl.hash" "$2/hsums/$1-tbl.hash";
|
||||
cp -f "$ssrc/hsums/$1.hash" "$2/hsums/$1.hash";
|
||||
cp -f "$ssrc/parts/$1.part.gz" "$2/parts/$1.part.gz";
|
||||
cp -f "$ssrc/tabls/$1.tbl" "$2/tabls/$1.tbl";
|
||||
cmp -s "$ssrc/hsums/$1-tbl.hash" "$2/hsums/$1-tbl.hash"
|
||||
sTbl=$?;
|
||||
cmp -s "$ssrc/hsums/$1-gz.hash" "$2/hsums/$1-gz.hash";
|
||||
sPart=$?;
|
||||
if [ $sPart -eq 0 ]; then
|
||||
cmp -s "$ssrc/hsums/$1.hash" "$2/hsums/$1.hash";
|
||||
sPart=$?;
|
||||
fi
|
||||
if [ $sTbl -ne 0 ]; then
|
||||
echo "Syncing: $1.tbl";
|
||||
cp -f "$ssrc/tabls/$1.tbl" "$2/tabls/$1.tbl";
|
||||
cp -f "$ssrc/hsums/$1-tbl.hash" "$2/hsums/$1-tbl.hash";
|
||||
fi
|
||||
if [ $sPart -ne 0 ]; then
|
||||
echo "Syncing: $1.part.gz";
|
||||
cp -f "$ssrc/hsums/$1-gz.hash" "$2/hsums/$1-gz.hash";
|
||||
cp -f "$ssrc/hsums/$1.hash" "$2/hsums/$1.hash";
|
||||
cp -f "$ssrc/parts/$1.part.gz" "$2/parts/$1.part.gz";
|
||||
fi
|
||||
echo "Verifying...";
|
||||
cmp -s "$ssrc/hsums/$1-gz.hash" "$2/hsums/$1-gz.hash";
|
||||
if [ $? -ne 0 ]; then
|
||||
|
29
backup-image/verify-all.sh
Executable file
29
backup-image/verify-all.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#/bin/bash
|
||||
echo "Verify All Backups!";
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: verify-all.sh [Storage disk root path]";
|
||||
exit 2;
|
||||
fi
|
||||
ssrc="";
|
||||
if [ -z $1 ]; then
|
||||
ssrc="/mnt";
|
||||
else
|
||||
ssrc="$1";
|
||||
fi
|
||||
echo "Storage disk root path: $ssrc";
|
||||
if [[ "$2" != "ikwid" ]]; then
|
||||
echo "Press Enter to Start...";
|
||||
read;
|
||||
fi
|
||||
rval=0;
|
||||
for cf in $ssrc/tabls/*; do
|
||||
if [ -e "$cf" ] && [ -f "$cf" ]; then
|
||||
./verify.sh $(basename "$cf" ".tbl") "$ssrc" "ikwid";
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Verify failed: $cf";
|
||||
rval=1;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "Finished!";
|
||||
exit $rval;
|
@ -11,14 +11,16 @@ else
|
||||
ssrc="$2";
|
||||
fi
|
||||
echo "Source Backup disk name: $1";
|
||||
echo "Sync storage disk root path: $ssrc";
|
||||
echo "Press Enter to Start...";
|
||||
read;
|
||||
echo "Storage disk root path: $ssrc";
|
||||
if [[ "$3" != "ikwid" ]]; then
|
||||
echo "Press Enter to Start...";
|
||||
read;
|
||||
fi
|
||||
mkdir -p /tmp/a;
|
||||
echo "Verifying...";
|
||||
echo "Calculating SHA512 sums...";
|
||||
((sha512sum "$ssrc/parts/$1.part.gz" > "/tmp/a/$1.part.gz.sum") && dd "if=/tmp/a/$1.part.gz.sum" bs=128 count=1 "of=/tmp/a/$1-gz.hash" && touch "/tmp/a/1.complete") &
|
||||
((sha512sum "$ssrc/tabls/$1.tbl" > "/tmp/a/$1.tbl.sum") && dd "if=/tmp/a/$1.tbl.sum" bs=128 count=1 "of=/mnt/hsums/$1-tbl.hash" && touch "/tmp/a/2.complete") &
|
||||
((sha512sum "$ssrc/tabls/$1.tbl" > "/tmp/a/$1.tbl.sum") && dd "if=/tmp/a/$1.tbl.sum" bs=128 count=1 "of=/tmp/a/$1-tbl.hash" && touch "/tmp/a/2.complete") &
|
||||
until [ -f "/tmp/a/1.complete" ] && [ -f "/tmp/a/2.complete" ]; do sleep 0.1; done;
|
||||
echo "Hashes:";
|
||||
cat /tmp/a/*.sum;
|
||||
|
Loading…
Reference in New Issue
Block a user