[MySQL] Simplified mysql command
This commit is contained in:
parent
02d2ec5b9c
commit
86b074751c
@ -9,9 +9,9 @@ retention=3
|
||||
mkdir -p $backup_dir
|
||||
|
||||
# database backup
|
||||
for DB in $(mysql -e 'show databases' -s --skip-column-names|grep -v 'information_schema\|performance_schema'); do
|
||||
for DB in $(mysql -e 'show databases' -sN|grep -v 'information_schema\|performance_schema'); do
|
||||
mysqldump $DB > "$backup_dir/$date.$DB.sql";
|
||||
done
|
||||
|
||||
# delete old backups
|
||||
find $backup_dir -type f -mtime +$retention -name '*.sql' -execdir rm -- '{}' \;
|
||||
find $backup_dir -type f -mtime +$retention -name '*.sql' -execdir rm -- '{}' \;
|
||||
|
Loading…
Reference in New Issue
Block a user