Update backup and sync imaging scripts.
This commit is contained in:
parent
14d880119a
commit
ad4004510b
@ -16,7 +16,7 @@ echo "Calculating SHA512 sums...";
|
|||||||
((gunzip -c "/mnt/parts/$2.part.gz" | sha512sum > "/tmp/a/$2.part.sum") && dd "if=/tmp/a/$2.part.sum" bs=128 count=1 "of=/tmp/a/$2.hash" && touch "/tmp/a/3.complete") &
|
((gunzip -c "/mnt/parts/$2.part.gz" | sha512sum > "/tmp/a/$2.part.sum") && dd "if=/tmp/a/$2.part.sum" bs=128 count=1 "of=/tmp/a/$2.hash" && touch "/tmp/a/3.complete") &
|
||||||
until [ -f "/tmp/a/1.complete" ] && [ -f "/tmp/a/2.complete" ] && [ -f "/tmp/a/3.complete" ]; do sleep 0.1; done;
|
until [ -f "/tmp/a/1.complete" ] && [ -f "/tmp/a/2.complete" ] && [ -f "/tmp/a/3.complete" ]; do sleep 0.1; done;
|
||||||
echo "Hashes:";
|
echo "Hashes:";
|
||||||
cat "/tmp/a/*.sum";
|
cat /tmp/a/*.sum;
|
||||||
echo;
|
echo;
|
||||||
cmp -s "/tmp/a/$1.hash" "/tmp/a/$2.hash";
|
cmp -s "/tmp/a/$1.hash" "/tmp/a/$2.hash";
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
@ -1,32 +1,33 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "Sync Backup!";
|
echo "Sync Backup!";
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
echo "Usage: sync.sh <Backup disk name> <Sync target disk name>";
|
echo "Usage: sync.sh <Backup disk name> <Sync target disk name> <Sync source disk name>";
|
||||||
exit 2;
|
exit 2;
|
||||||
fi
|
fi
|
||||||
echo "Source Backup disk name: $1";
|
echo "Source Backup disk name: $1";
|
||||||
echo "Sync target disk name: $2";
|
echo "Sync target disk name: $2";
|
||||||
|
echo "Sync source disk name: $3";
|
||||||
echo "Press Enter to Start...";
|
echo "Press Enter to Start...";
|
||||||
read;
|
read;
|
||||||
mkdir -p /tmp/a;
|
mkdir -p /tmp/a;
|
||||||
echo "Syncing...";
|
echo "Syncing...";
|
||||||
cp -f "/mnt/hsums/$1-gz.hash" "$2/hsums/$1-gz.hash";
|
cp -f "$3/hsums/$1-gz.hash" "$2/hsums/$1-gz.hash";
|
||||||
cp -f "/mnt/hsums/$1-tbl.hash" "$2/hsums/$1-tbl.hash";
|
cp -f "$3/hsums/$1-tbl.hash" "$2/hsums/$1-tbl.hash";
|
||||||
cp -f "/mnt/hsums/$1.hash" "$2/hsums/$1.hash";
|
cp -f "$3/hsums/$1.hash" "$2/hsums/$1.hash";
|
||||||
cp -f "/mnt/parts/$1.part.gz" "$2/parts/$1.part.gz";
|
cp -f "$3/parts/$1.part.gz" "$2/parts/$1.part.gz";
|
||||||
cp -f "/mnt/tabls/$1.tbl" "$2/tabls/$1.tbl";
|
cp -f "$3/tabls/$1.tbl" "$2/tabls/$1.tbl";
|
||||||
echo "Verifying...";
|
echo "Verifying...";
|
||||||
cmp -s "/mnt/hsums/$1-gz.hash" "$2/hsums/$1-gz.hash";
|
cmp -s "$3/hsums/$1-gz.hash" "$2/hsums/$1-gz.hash";
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Hash mismatch with $1-gz.hash !";
|
echo "Hash mismatch with $1-gz.hash !";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
cmp -s "/mnt/hsums/$1-tbl.hash" "$2/hsums/$1-tbl.hash";
|
cmp -s "$3/hsums/$1-tbl.hash" "$2/hsums/$1-tbl.hash";
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Hash mismatch with $1-tbl.hash !";
|
echo "Hash mismatch with $1-tbl.hash !";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
cmp -s "/mnt/hsums/$1.hash" "$2/hsums/$1.hash";
|
cmp -s "$3/hsums/$1.hash" "$2/hsums/$1.hash";
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Hash mismatch with $1.hash !";
|
echo "Hash mismatch with $1.hash !";
|
||||||
exit 1;
|
exit 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user