Skip to content

Commit

Permalink
Fixed deletion after X number of days not working due to reusing vari…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
AlexWinder committed Jan 31, 2019
1 parent 709633c commit a4a7e70
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mysql_backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@ umask 177
# Dump database into SQL file
mysqldump --lock-tables --user=$user --password=$password --host=$host $db_name > $backup_full_name

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

0 comments on commit a4a7e70

Please sign in to comment.