mirror of
https://github.com/xzeldon/vwdump.git
synced 2025-07-16 07:14:41 +03:00
Quality of life improvements (#17)
- Removed quotation marks with mounting volumes in docker-compose section. - Replaced INFO prefix with each echo with a timestamp. - Subsequently, echoes that have a timestamp at the end have been adjusted to remove them. - When deleting, it first checks if there are files to delete. - An appropriate echo will be shown in both circumstances.
This commit is contained in:
17
delete.sh
17
delete.sh
@ -6,8 +6,17 @@ sleep 1m
|
||||
# Go to the backups directory.
|
||||
cd /backups
|
||||
|
||||
# Delete tar.xz archives older than x days.
|
||||
find . -iname "*.tar.xz" -type f -mtime +$DELETE_AFTER -exec rm -f {} \;
|
||||
# Find all tar.xz archives older than x days and store them in a variable.
|
||||
TO_DELETE=$(find . -iname "*.tar.xz" -type f -mtime +$DELETE_AFTER)
|
||||
|
||||
# Echo that script ran.
|
||||
echo "[INFO] Deleted files older than $DELETE_AFTER days."
|
||||
# Check if TO_DELETE is empty.
|
||||
if [ ! -z "$TO_DELETE" ]; then
|
||||
# Delete tar.xz archives older than x days.
|
||||
find . -iname "*.tar.xz" -type f -mtime +$DELETE_AFTER -exec rm -f {} \;
|
||||
|
||||
# Echo that archives were deleted.
|
||||
echo "[$(date +"%F %r")] Deleted archives older than $DELETE_AFTER days."
|
||||
else
|
||||
# Echo that there are no archives to delete.
|
||||
echo "[$(date +"%F %r")] No archives older than $DELETE_AFTER days to delete."
|
||||
fi
|
||||
|
Reference in New Issue
Block a user