txtfile is now a variable and the script use it

This commit is contained in:
Djan GICQUEL 2022-06-12 17:40:25 +02:00
parent f95519281d
commit bfc2fd889a
1 changed files with 7 additions and 7 deletions

View File

@ -19,19 +19,19 @@ if [ "$repo2" = "" ];then
echo "repo2 is empty";exit
fi
if [ ! -f "config" "$repo1" ]; then
if [ ! -f "$repo1/config" ]; then
echo "unable to find borgbackup repo config file.";sleep 3;exit
fi
if [ ! -d "data" "$repo1" ]; then
if [ ! -d "$repo1/data" ]; then
echo "unable to find borgbackup data folder.";sleep 3;exit
fi
if [ ! -f "config" "$repo2" ]; then
if [ ! -f "$repo2/config" ]; then
echo "unable to find borgbackup repo config file.";sleep 3;exit
fi
if [ ! -d "data" "$repo2" ]; then
if [ ! -d "$repo2/data" ]; then
echo "unable to find borgbackup data folder.";sleep 3;exit
fi
@ -42,7 +42,7 @@ echo "$repo2"
echo ""
read -p "OK ?" CONTINUE
if [ -f reborg_repo1.txt ];then
if [ -f $txtfile ];then
echo "File exist, resuming."
else
echo "$(borg list --format='{archive} {time:%Y-%m-%dT%H:%M:%S}{LF}' $repo1)" > $txtfile
@ -50,7 +50,7 @@ else
read -p "Continue ?" CONTINUE
fi
cat reborg_repo1.txt | while read A T;do
cat $txtfile | while read A T;do
echo "Importing $A..."
borg export-tar $repo1::$A - | borg import-tar --timestamp=$T $repo2::$A -
echo "Archive $A imported."
@ -59,7 +59,7 @@ tail -n +2 "$txtfile" > "$txtfile.tmp" && mv "$txtfile.tmp" "$txtfile"
done
echo "Deleting $txtfile"
rm reborg_repo1.txt
rm $txtfile
echo ""
echo "End of the script."