bash-stuff/backup-image/sync-all.sh

31 lines
619 B
Bash
Raw Permalink Normal View History

2024-08-30 13:16:28 +01:00
#/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;