public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
data/Dockerfiles/dovecot/repl_health.sh
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
#!/bin/bash
3
source /source_env.sh
5
# Do not attempt to write to slave
6
if [[ ! -z ${REDIS_SLAVEOF_IP} ]]; then
7
REDIS_CMDLINE="redis-cli -h ${REDIS_SLAVEOF_IP} -p ${REDIS_SLAVEOF_PORT} -a ${REDISPASS} --no-auth-warning"
8
else
9
REDIS_CMDLINE="redis-cli -h redis -p 6379 -a ${REDISPASS} --no-auth-warning"
10
fi
12
# Is replication active?
13
# grep on file is less expensive than doveconf
14
if [ -n ${MAILCOW_REPLICA_IP} ]; then
15
${REDIS_CMDLINE} SET DOVECOT_REPL_HEALTH 1 > /dev/null
16
exit
17
fi
19
FAILED_SYNCS=$(doveadm replicator status | grep "Waiting 'failed' requests" | grep -oE '[0-9]+')
21
# Set amount of failed jobs as DOVECOT_REPL_HEALTH
22
# 1 failed job for mailcow.local is expected and healthy
23
if [[ "${FAILED_SYNCS}" != 0 ]] && [[ "${FAILED_SYNCS}" != 1 ]]; then
24
printf "Dovecot replicator has %d failed jobs\n" "${FAILED_SYNCS}"
25
${REDIS_CMDLINE} SET DOVECOT_REPL_HEALTH "${FAILED_SYNCS}" > /dev/null
26
else
27
${REDIS_CMDLINE} SET DOVECOT_REPL_HEALTH 1 > /dev/null
28
fi