Skip to content

Commit

Permalink
rollback using ! in bash
Browse files Browse the repository at this point in the history
  • Loading branch information
dyrnq committed Nov 30, 2024
1 parent d7a1733 commit 9baa2f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rootfs/etc/s6-overlay/s6-rc.d/cluster/run
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if grep -q -i "stand" <<< "${RUN_MODE}"; then
wait4x --timeout 86400s mysql "${fe_mysql_user}:${fe_mysql_pass}@tcp(127.0.0.1:${fe_mysql_port})/" && \
(
## check if the backend is already added
if mysql -u${fe_mysql_user} ${cmd_fe} -P${fe_mysql_port} -h127.0.0.1 -e "show backends" | grep -q -v -E "${join_backend}.*9050"; then
if ! mysql -u${fe_mysql_user} ${cmd_fe} -P${fe_mysql_port} -h127.0.0.1 -e "show backends" | grep -q -E "${join_backend}.*9050"; then
mysql -u${fe_mysql_user} ${cmd_fe} -P${fe_mysql_port} -h127.0.0.1 -e "ALTER SYSTEM ADD BACKEND '${join_backend}:9050'"
fi
)
Expand Down Expand Up @@ -109,7 +109,7 @@ wait4x --timeout 86400s mysql "${fe_mysql_user}:${fe_mysql_pass}@tcp(${fe_master
# echo "${val_grep}"
# echo "###########################################"
## check if the frontend is already added
if mysql -u${fe_mysql_user} ${cmd_fe} -P${fe_mysql_port} -h${fe_master} -e "show frontends;" | grep -q -v -E "${val_grep}"; then
if ! mysql -u${fe_mysql_user} ${cmd_fe} -P${fe_mysql_port} -h${fe_master} -e "show frontends;" | grep -q -E "${val_grep}"; then
mysql -u${fe_mysql_user} ${cmd_fe} -P${fe_mysql_port} -h${fe_master} -e "ALTER SYSTEM ADD FOLLOWER '${val}'"
fi
done
Expand Down Expand Up @@ -158,7 +158,7 @@ wait4x --timeout 86400s mysql "${fe_mysql_user}:${fe_mysql_pass}@tcp(${fe_master
fi

val_grep=${val//:/.*}
if mysql -u${fe_mysql_user} ${cmd_fe} -P${fe_mysql_port} -h${fe_master} -e "show backends;" | grep -q -v -E "${val_grep}"; then
if ! mysql -u${fe_mysql_user} ${cmd_fe} -P${fe_mysql_port} -h${fe_master} -e "show backends;" | grep -q -E "${val_grep}"; then
mysql -u${fe_mysql_user} ${cmd_fe} -P${fe_mysql_port} -h${fe_master} -e "ALTER SYSTEM ADD BACKEND '${val}'"
fi
)
Expand Down

0 comments on commit 9baa2f4

Please sign in to comment.