scripting:mariadb-backup.sh
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
scripting:mariadb-backup.sh [2015-03-09 01:15] – created gabriel | scripting:mariadb-backup.sh [2019-08-10 17:26] (current) – linked to https://gitlab.com/unxis/mariadb-backup.sh gabriel | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== mariadb-backup.sh | + | ====== mariadb-backup.sh ====== |
- | This script is useful | + | //This script |
+ | |||
+ | This script can be used to dump a MariaDB (or MySQL) database to disk and to rotate through a given number of backups. | ||
* **-q** run silently (for use in crontabs or other non-interactive settings) | * **-q** run silently (for use in crontabs or other non-interactive settings) | ||
* **-k N** number of recent backups to keep (default is 7) | * **-k N** number of recent backups to keep (default is 7) | ||
+ | |||
+ | The script assumes that backup user has a '' | ||
<code bash> | <code bash> | ||
Line 11: | Line 15: | ||
# mariadb-backup.sh - a simple script to dump and rotate MariaDB backups | # mariadb-backup.sh - a simple script to dump and rotate MariaDB backups | ||
# | # | ||
- | # Copyright (c) 2011 Gabriel M. O' | + | # Copyright (c) 2015 Gabriel M. O' |
# | # | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
Line 77: | Line 81: | ||
# remove old backups | # remove old backups | ||
cd $backup_root | cd $backup_root | ||
+ | |||
+ | # create a link to current backup | ||
+ | rm -f latest && ln -s ${stamp} latest | ||
# find out how many backups are in this directory | # find out how many backups are in this directory |
scripting/mariadb-backup.sh.1425878101.txt.gz · Last modified: 2015-03-09 01:15 by gabriel