git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin/sqlbackup
diff options
context:
space:
mode:
authormail_redacted_for_web 2020-04-03 16:35:37 +0200
committermail_redacted_for_web 2020-04-03 16:35:37 +0200
commit6f146ea65ae86ff01904ddfceb9e266b42d35fa5 (patch)
tree86a11abc6dec79419a10c2006fa22d167c1b0d0f /bin/sqlbackup
parentc008a81884dae827388d1d7be5ff09ebb92515a4 (diff)
downloadrhel-scripts-6f146ea65ae86ff01904ddfceb9e266b42d35fa5.tar.bz2
Adding verbosity about flushing logs
Diffstat (limited to 'bin/sqlbackup')
-rwxr-xr-xbin/sqlbackup9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/sqlbackup b/bin/sqlbackup
index 890f2f6..552198f 100755
--- a/bin/sqlbackup
+++ b/bin/sqlbackup
@@ -143,8 +143,17 @@ TIME="$(date +"%Y-%m-%dT%H:%M:%S%z")"
[ "$SCHANAUZE" -ne 1 ]&&printf "File timestamp: %s\n" "$TIME"
printf "File timestamp: %s\n" "$TIME" > "$BLOG"
# Flush prior to backups, do not purge.
+[ "$SCHANAUZE" -ne 1 ]&&printf "\n[....] Flushing logs.\033[s..\033[0m"
[ ! -z "$LOGGER" ]&&[ "$LOGGER" -eq 1 ]&&mlogger info "flushing logs"
mysql --user="$BUSER" --password="$(cat $PWFL)" -e "flush logs \\G"
+if [ "$?" -ne 0 ];then
+ [ ! -z "$LOGGER" ]&&[ "$LOGGER" -eq 1 ]&&mlogger err "flushing logs failed, check $BLOG"
+ [ "$SCHANAUZE" -ne 1 ]&&printf "$NEE\n\n"
+ exit 101
+else
+ [ "$SCHANAUZE" -ne 1 ]&&printf "$OGE\n\n"
+fi
+exit 0
LOGPOS="$(mysql --user="$BUSER" --password="$(cat $PWFL)" -e "show master status \G"|grep Position|awk '{print $NF}')"
[ "$SCHANAUZE" -ne 1 ]&&printf "Log position: %s\n" "$LOGPOS"
printf "Log position: %s\n" "$LOGPOS" > "$BLOG"