Skip to content

Commit

Permalink
mysql-health.sh: mysqlcheck starting hour can be changed by user now
Browse files Browse the repository at this point in the history
  • Loading branch information
LobbyLobster committed Sep 10, 2024
1 parent 8a0a93e commit c5f8771
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions configs/db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ mysql:
cluster:
enabled: false
size: 3
check_table_day: "Sun"
check_table_hour: "05:00"
alarm:
enabled: true
12 changes: 11 additions & 1 deletion scripts/monodb/mysql-health.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ function parse_config_mysql() {
PROCESS_LIMIT=$(yaml .mysql.process_limit $CONFIG_PATH_MONODB)
CLUSTER_SIZE=$(yaml .mysql.cluster.size $CONFIG_PATH_MONODB)
IS_CLUSTER=$(yaml .mysql.cluster.enabled $CONFIG_PATH_MONODB)
CHECK_TABLE_DAY=$(yaml .mysql.cluster.check_table_day $CONFIG_PATH_MONODB)
CHECK_TABLE_HOUR=$(yaml .mysql.cluster.check_table_hour $CONFIG_PATH_MONODB)

SEND_ALARM=$(yaml .mysql.alarm.enabled $CONFIG_PATH_MONODB "$SEND_ALARM")
}
Expand Down Expand Up @@ -228,7 +230,15 @@ function main() {
#check_flow_control
fi

if [ "$(date "+%H:%M")" == "05:00" ]; then
if [ -z "$CHECK_TABLE_DAY" ]; then
CHECK_TABLE_DAY="Sun"
fi

if [ -z "$CHECK_TABLE_HOUR" ]; then
CHECK_TABLE_HOUR="05:00"
fi

if [ "$(date "+%a %H:%M")" == "$CHECK_TABLE_DAY $CHECK_TABLE_HOUR" ]; then
check_db
fi
}
Expand Down

0 comments on commit c5f8771

Please sign in to comment.