tabernarious / f5-automated-backup-iapp

F5 iApp for automated backups to the local device and to network locations.
37 stars 25 forks source link

Clean up old SMB backups #4

Closed tabernarious closed 6 years ago

tabernarious commented 6 years ago

A commonly-requested feature is to add auto-pruning to remote backup locations.

This could be done relatively easily for SMB, but would need to be done very carefully. If the mounted volume stored any other files (e.g. backups from other devices), this iApp could very easily delete other critical backups. This would need to be implemented with a check against the configured file name format configured in the iApp (e.g. only delete files with the hostname of this device, and if the file matches the timestamp format).

rensozo commented 6 years ago

Would this work? exec find /path/to/local/mountpoint -name '*.ucs' -mtime +15 -exec rm {} \;

tabernarious commented 6 years ago

@rensozo, Your suggestion could definitely work but would need to have some disclaimers about what files are stored in the remote directory. That command would delete any UCS archive (from any device) last modified more than ~15 days ago. Another BIG-IP (or another instance of this iApp) could be dropping files in the same remote folder without the proposed "auth-cleanup" setting, but this iApp instance would go ahead and delete the files. I hope to return to this iApp in the coming weeks and months to make some tweaks. Watch for updates!

tabernarious commented 6 years ago

@rensozo I have implemented auto-pruning for SMB in iApp v3.1.3. It is based on file count (not age--maybe something I can implement later) and there is an option to only prune files generated by this iApp (using a Unique Suffix). Please give it a try and let me know if it will work for you.