fix "permission denied" while removing old backups

This commit is contained in:
olli 2023-03-01 09:54:34 +01:00
parent fb647fa1d1
commit 737047143e

View File

@ -166,7 +166,8 @@ var-lib-docker
yearmonthbefore="$(date +%Y-%m- --date='-1 month')"
$sshopts find $BACKUPSRVPATH_WITH_HOST -mindepth 1 -maxdepth 1 -type d -name "backup-*" | egrep -v "backup-$yearmonth|backup-$yearmonthbefore|backup-20[0-9][0-9]-[0-9][0-9]-monthly" | while read g_toremove
do
g_echo_warn "Removing Backup $g_toremove"
g_echo_warn "Removing old Backup $g_toremove"
g_runcmd $sshopts chmod -R +w "$g_toremove"
g_runcmd $sshopts rm -r "$g_toremove"
done
done