git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin/sqlbackup
diff options
context:
space:
mode:
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"