delete archive option

This commit is contained in:
Pavel Kuleshov 2023-03-10 07:46:47 +08:00
parent 0a5f0a27ee
commit a9aba2cdf4

View File

@ -13,6 +13,9 @@ archive_dir='archives/'
mode='archive'
#mode='files'
delete_archive=true
#delete_archive=false
if [ "$mode" == "files" ]; then
rsync -a --exclude-from=$exclude_file --password-file=$password_file $source $user@$ip::$destination
else
@ -26,7 +29,7 @@ else
rsync -a --exclude-from=$exclude_file --password-file=$password_file $archive_dir/* $user@$ip::$destination
if [ $? -eq 0 ]; then
if [ $? -eq 0 ] && [ "$delete_archive" = true ]; then
rm -f $archive_dir/*
fi
fi