Skip to content

Instantly share code, notes, and snippets.

@moznion
Last active June 8, 2016 04:42
Show Gist options
  • Save moznion/1f5b5583f64f997876b15d930a0c8702 to your computer and use it in GitHub Desktop.
Save moznion/1f5b5583f64f997876b15d930a0c8702 to your computer and use it in GitHub Desktop.
#!/bin/bash
ADJUST="10"
DB_NAME="your_table"
DUMP_LOCATION="/tmp"
cd ${DUMP_LOCATION} || exit 0
mysqldump -uroot ${DB_NAME} > $(date "+%Y%m%d").dump
nice -n ${ADJUST} find . -mtime +5 -path "2*.dump" -exec rm -f {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment