diff options
Diffstat (limited to 'rsync_tmbackup.sh')
| -rwxr-xr-x | rsync_tmbackup.sh | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh index 0cafdf9..e9446c8 100755 --- a/rsync_tmbackup.sh +++ b/rsync_tmbackup.sh @@ -72,7 +72,7 @@ fn_expire_backup() { fi fn_log_info "Expiring $1" - fn_rm_dir_fast "$1" + fn_rm_dir "$1" } fn_parse_ssh() { @@ -112,33 +112,10 @@ fn_rm_file() { fn_run_cmd "rm -f -- '$1'" } -# Removes a directory fn_rm_dir() { fn_run_cmd "rm -rf -- '$1'" } -# This is an optimized way to delete a directory. It only makes sense to use -# it when deleting huge directories, so it's only for expiring backups at -# the moment. -fn_rm_dir_fast() { - local DIR="$1" - - if [[ -z $DIR ]]; then - fn_log_error "Directory path is empty - aborting." - exit 1 - fi - - DIR="$DIR/" - - if [[ -d $DIR && ! -L $DIR ]]; then - fn_run_cmd "mkdir -p /tmp/rsync-time-backup-emptydir" - fn_run_cmd "rsync -a --delete /tmp/rsync-time-backup-emptydir/ '$DIR'" - fn_run_cmd "rm -rf -- /tmp/rsync-time-backup-emptydir '$DIR'" - else - fn_log_error "Trying to delete a directory that either does not exist or is not a directory: $DIR" - fi -} - fn_touch() { fn_run_cmd "touch -- '$1'" } |
