add cleanup param for backup script
Related: PROD-27550 (PROD:27550)
Change-Id: I50737964e780765b2bc15156772c2d121d975143
diff --git a/xtrabackup/files/innobackupex-client-runner.sh b/xtrabackup/files/innobackupex-client-runner.sh
index a0ae1ac..a5d14c9 100644
--- a/xtrabackup/files/innobackupex-client-runner.sh
+++ b/xtrabackup/files/innobackupex-client-runner.sh
@@ -13,35 +13,15 @@
usage () {
echo ""
echo "USAGE: "
- echo " innobackupex-runner.sh [-s -f -h]"
+ echo " innobackupex-runner.sh [-s -f -h -c]"
echo " -s makes the script to skip the cleanup"
echo " -f forces the script to run the full backup instead of an incremental one"
echo " -h shows this help"
+ echo " -c run only cleanup (no backup will be done)"
}
SKIPCLEANUP="false"
FORCEFULL="false"
-while getopts ":sfh" opt; do
- case $opt in
- s)
- echo "Cleanup will be skipped" >&2
- SKIPCLEANUP="true"
- ;;
- f)
- echo "Full backup will be force triggered"
- FORCEFULL="true"
- ;;
- h)
- usage
- exit 0
- ;;
- \?)
- echo "Invalid option: -$OPTARG" >&2
- usage
- exit 1
- ;;
- esac
-done
USEROPTIONS="--user={{ client.database.user }} --password={{ client.database.password }}{%- if client.database.host is defined %} --host {{ client.database.host }} --port {{ client.database.get('port', '3306') }}{%- else %} --socket=/var/run/mysqld/mysqld.sock{%- endif %}"
#TMPFILE="/var/log/backups/innobackupex-runner.$$.tmp"
LOGDIR="/var/log/backups"
@@ -269,6 +249,33 @@
fi
}
+while getopts ":sfhc" opt; do
+ case $opt in
+ s)
+ echo "Cleanup will be skipped" >&2
+ SKIPCLEANUP="true"
+ ;;
+ c)
+ echo "Cleanup backups" >&2
+ cleanup_backup
+ exit 0
+ ;;
+ f)
+ echo "Full backup will be force triggered"
+ FORCEFULL="true"
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ \?)
+ echo "Invalid option: -$OPTARG" >&2
+ usage
+ exit 1
+ ;;
+ esac
+done
+
prerequisites
backup
cleanup_backup