Web lists-archives.com

[Samba] backup-script/backup_samba4




Hi!

i am testing Louis van Belle backup script. it works quite well. Thank you for sharing this!

https://github.com/thctlo/samba4/blob/master/backup-script/backup_samba4

but i think there is an error in the KEEP_DAYS code as the string '\-$KEEP_DAY1\-|\-$KEEP_DAY2-' is not interpolated so the egrep does exclude anything from rm call. So no files older than $DAYS are kept...

# Remove any files over $DAYS days old from backup dir, keep the $KEEP_DAY1 and $KEEP_DAY2 of the month.
if [ ${KEEP_DAYS} = "yes" ]; then
    ${DEBUG} "Deleting any backup files over ${DAYS} days old, keeping date $KEEP_DAY1 and $KEEP_DAY2 of the month."     ${CMD_FIND} ${STOREDIR} -name "*.bz2" -mtime +${DAYS} -type f -print | xargs -0 | egrep -v '\-$KEEP_DAY1\-|\-$KEEP_DAY2-' | xargs ${CMD_RM} >/dev/null 2>&1
fi

should be

if [ ${KEEP_DAYS} = "yes" ]; then
    ${DEBUG} "Deleting any backup files over ${DAYS} days old, keeping date $KEEP_DAY1 and $KEEP_DAY2 of the month."     ${CMD_FIND} ${STOREDIR} -name "*.bz2" -mtime +${DAYS} -type f -print | xargs -0 | egrep -v "\-$KEEP_DAY1\-|\-$KEEP_DAY2\-" | xargs ${CMD_RM} >/dev/null 2>&1
fi

I hope this is the right place to report.


--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba