Fix options parsing for backup script
Fixes: PROD-27148 (PROD:27148)
Change-Id: Ie6d7d514f3cb3b2e49c60b861682b60f50a31956
diff --git a/xtrabackup/files/innobackupex-client-runner.sh b/xtrabackup/files/innobackupex-client-runner.sh
index 378f157..f2b8e22 100644
--- a/xtrabackup/files/innobackupex-client-runner.sh
+++ b/xtrabackup/files/innobackupex-client-runner.sh
@@ -8,19 +8,35 @@
# Every time it runs will generate an incremental backup except for the first time (full backup).
# FULLBACKUPLIFE variable will define your full backups schedule.
+usage () {
+ echo ""
+ echo "USAGE: "
+ echo " innobackupex-runner.sh [-s -f -h]"
+ 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"
+}
+
SKIPCLEANUP=false
-while getopts ":skip-cleanup" opt; do
+FORCEFULL=false
+while getopts ":sfh" opt; do
case $opt in
- skip-cleanup)
+ s)
echo "Cleanup will be skipped" >&2
SKIPCLEANUP=true
;;
- force-full)
+ f)
echo "Full backup will be force triggered"
FORCEFULL=true
;;
+ h)
+ usage
+ exit 0
+ ;;
\?)
echo "Invalid option: -$OPTARG" >&2
+ usage
+ exit 1
;;
esac
done