Skip to content

Commit a4a7e70

Browse files
committed
Fixed deletion after X number of days not working due to reusing variable
1 parent 709633c commit a4a7e70

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mysql_backup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@ umask 177
3535
# Dump database into SQL file
3636
mysqldump --lock-tables --user=$user --password=$password --host=$host $db_name > $backup_full_name
3737

38+
# Set a value to be used to find all backups with the same name
39+
find_backup_name="${backup_location}/${website}/${db_name}-*.sql"
3840
# Delete files older than the number of days defined
39-
find $backup_full_name -mtime +${days} -type f -delete
41+
find $find_backup_name -mtime +$days -type f -delete

0 commit comments

Comments
 (0)