git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/sqlbackup13
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/sqlbackup b/bin/sqlbackup
index 69bbfbc..018d700 100755
--- a/bin/sqlbackup
+++ b/bin/sqlbackup
@@ -151,10 +151,10 @@ printf "File timestamp: %s\n" "$TIME" >> "$BLOG"
mysql --user="$BUSER" --password="$(cat $PWFL)" -e "flush logs \\G" 2>> "$BLOG"
if [ "$?" -ne 0 ];then
[ ! -z "$LOGGER" ]&&[ "$LOGGER" -eq 1 ]&&mlogger err "flushing logs failed, check $BLOG"
- [ "$SCHANAUZE" -ne 1 ]&&printf "$NEE\n\n"
+ [ "$SCHANAUZE" -ne 1 ]&&printf "%b\n\n" "$NEE"
exit 101
else
- [ "$SCHANAUZE" -ne 1 ]&&printf "$OGE\n\n"
+ [ "$SCHANAUZE" -ne 1 ]&&printf "%b\n\n" "$OGE"
fi
exit 0
LOGPOS="$(mysql --user="$BUSER" --password="$(cat $PWFL)" -e "show master status \G"|grep Position|awk '{print $NF}')"
@@ -196,7 +196,7 @@ for i in "${DBARR[@]}";do
fi
if [ "$?" -ne 0 ];then
[ ! -z "$LOGGER" ]&&[ "$LOGGER" -eq 1 ]&&mlogger err "backup of $i failed, check $BLOG"
- [ "$SCHANAUZE" -ne 1 ]&&echo -e "$NEE"
+ [ "$SCHANAUZE" -ne 1 ]&&printf "%b\n" "$NEE"
[ ! -z "$LOGGER" ]&&[ "$LOGGER" -eq 1 ]&&mlogger err "backup failed, check $BLOG"
exit 2
fi
@@ -204,7 +204,7 @@ for i in "${DBARR[@]}";do
[ "$SCHANAUZE" -ne 1 ]&&printf ".. \033[u\033[K \033[1;30mcompression running...\033[0m"
xz "$BDIR/$i-$TIME.sql"&&chmod 0600 "$BDIR/$i-$TIME.sql.xz"
if [ "$?" -ne 0 ];then
- [ "$SCHANAUZE" -ne 1 ]&&echo -e "$NEE"
+ [ "$SCHANAUZE" -ne 1 ]&&printf "%b\n" "$NEE"
[ ! -z "$LOGGER" ]&&[ "$LOGGER" -eq 1 ]&&mlogger err "compression failed, check $BLOG"
exit 3
fi
@@ -215,9 +215,10 @@ done
[ ! -z "$LOGGER" ]&&[ "$LOGGER" -eq 1 ]&&mlogger info "Purging binary logs..."
mysql --user="$BUSER" --password="$(cat $PWFL)" -e "purge binary logs to \"$BINLOGF\" \\G" 2>> "$BLOG"
if [ "$?" -ne 0 ];then
- [ "$SCHANAUZE" -ne 1 ]&&echo -e "$NEE"
+ [ "$SCHANAUZE" -ne 1 ]&&printf "%b\n" "$NEE"
[ ! -z "$LOGGER" ]&&[ "$LOGGER" -eq 1 ]&&mlogger err "purging of binary logs failed, check $BLOG"
exit 3
fi
sleep 0.1337
-echo -e "$OGE"
+[ "$SCHANAUZE" -ne 1 ]&&printf "%b\n" "$OGE"
+[ ! -z "$LOGGER" ]&&[ "$LOGGER" -eq 1 ]&&mlogger info "sqlbackup finished."