mysql: improve shell syntax for mysql_skip script
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2776|4|2772|5|:+1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/254//ansiblelint">Evolix » ansible-roles » unstable #254</a>
gitea/ansible-roles/pipeline/head This commit looks good
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2776|4|2772|5|:+1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/254//ansiblelint">Evolix » ansible-roles » unstable #254</a>
gitea/ansible-roles/pipeline/head This commit looks good
This commit is contained in:
parent
7b667d1650
commit
8706a35705
|
@ -12,15 +12,18 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
* userlogrotate: rotate also php.log.
|
* userlogrotate: rotate also php.log.
|
||||||
* nagios-nrpe: add a NRPE check-local command with completion.
|
* nagios-nrpe: add a NRPE check-local command with completion.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
* elasticsearch: improve networking configuration
|
* elasticsearch: improve networking configuration
|
||||||
* evolinux-users: remove Stretch references in tasks that also apply to next Debian versions.
|
* evolinux-users: remove Stretch references in tasks that also apply to next Debian versions
|
||||||
|
* mysql: improve shell syntax for mysql_skip script
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
* packweb-apache,nagios-nrpe: add missing task and config for PHP 8.2 container
|
* packweb-apache,nagios-nrpe: add missing task and config for PHP 8.2 container
|
||||||
* potsfix: add missing `localhost.$mydomain` to mydestination
|
* potsfix: add missing `localhost.$mydomain` to mydestination
|
||||||
|
|
||||||
|
|
|
@ -18,29 +18,28 @@ log_file="/var/log/mysql_skip.log"
|
||||||
mysql_skip_error() {
|
mysql_skip_error() {
|
||||||
error="$1"
|
error="$1"
|
||||||
|
|
||||||
error="$(date --iso-8601=seconds) Skiping: $error"
|
mysql ${mysql_opt} -e 'SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;'
|
||||||
printf "Skipping: $error\n"
|
|
||||||
mysql $mysql_opt -e 'SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;'
|
|
||||||
|
|
||||||
[ -n "$log_file" ] && echo "$error" >>"$log_file"
|
printf 'Skipping: %s\n' "$error"
|
||||||
|
[ -n "$log_file" ] && printf '%s Skipping: %s\n' "$(date --iso-8601=seconds)" "$error" >>"$log_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
slave_status="$(mysql $mysql_opt -e 'SHOW SLAVE STATUS\G')"
|
slave_status="$(mysql ${mysql_opt} -e 'SHOW SLAVE STATUS\G')"
|
||||||
seconds_behind_master=$(echo "$slave_status" |grep 'Seconds_Behind_Master: ' |awk -F ' ' '{print $2}')
|
seconds_behind_master=$(echo "${slave_status}" |grep 'Seconds_Behind_Master: ' |awk -F ' ' '{print $2}')
|
||||||
last_SQL_error="$(echo "$slave_status" |grep 'Last_SQL_Error: ' |sed 's/^.\+Last_SQL_Error: //')"
|
last_SQL_error="$(echo "${slave_status}" |grep 'Last_SQL_Error: ' |sed 's/^.\+Last_SQL_Error: //')"
|
||||||
|
|
||||||
if [ "$seconds_behind_master" = "0" ]; then
|
if [ "${seconds_behind_master}" = "0" ]; then
|
||||||
#printf 'Replication is up to date!\n'
|
#printf 'Replication is up to date!\n'
|
||||||
if [ "$exit_when_uptodate" = "true" ]; then
|
if [ "${exit_when_uptodate}" = "true" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ -z "$last_SQL_error" ]; then
|
elif [ -z "$last_SQL_error" ]; then
|
||||||
sleep $sleep_interval
|
sleep ${sleep_interval}
|
||||||
|
|
||||||
elif echo "$last_SQL_error" |grep -q -f $error_messages; then
|
elif echo "$last_SQL_error" |grep -q -f $error_messages; then
|
||||||
mysql_skip_error "$last_SQL_error"
|
mysql_skip_error "${last_SQL_error}"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
Loading…
Reference in a new issue