NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
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

Commit

[Watchdog] More fixes for watchdog...

f00b563d
andryyy <[email protected]> 7 years ago
data/Dockerfiles/watchdog/Dockerfile  |  3 ++-
 data/Dockerfiles/watchdog/watchdog.sh | 15 +++------------
 docker-compose.yml                    |  2 +-
 3 files changed, 6 insertions(+), 14 deletions(-)

Diff

diff --git a/data/Dockerfiles/watchdog/Dockerfile b/data/Dockerfiles/watchdog/Dockerfile
index e857ebe9..9ada1dc0 100644
--- a/data/Dockerfiles/watchdog/Dockerfile
+++ b/data/Dockerfiles/watchdog/Dockerfile
@@ -33,6 +33,7 @@ RUN apk add --update \
 
 COPY watchdog.sh /watchdog.sh
 
-ENTRYPOINT ["/sbin/tini", "-g", "--"]
+#ENTRYPOINT ["/sbin/tini", "-g", "--"]
 # Less verbose
+
 CMD /watchdog.sh 2> /dev/null
diff --git a/data/Dockerfiles/watchdog/watchdog.sh b/data/Dockerfiles/watchdog/watchdog.sh
index 80141fb5..fbef6893 100755
--- a/data/Dockerfiles/watchdog/watchdog.sh
+++ b/data/Dockerfiles/watchdog/watchdog.sh
@@ -529,19 +529,11 @@ olefy_checks() {
 }
 
 # Notify about start
-if [[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]] && [[ ! -f /tmp/watchdog_reload ]]; then
+if [[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]]; then
   mail_error "watchdog-mailcow" "Watchdog started monitoring mailcow."
-  rm /tmp/watchdog_reload
 fi
 
 # Create watchdog agents
-(
-  touch /tmp/watchdog_reload
-  sleep 86400
-  echo "Reloading watchdog"
-  killall watchdog
-  kill 1
-) &
 
 (
 while true; do
@@ -759,15 +751,14 @@ while true; do
     log_msg "acme-mailcow did not complete successfully"
     [[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]] && mail_error "${com_pipe_answer}" "Please check acme-mailcow for further information."
   elif [[ ${com_pipe_answer} == "fail2ban" ]]; then
-    F2B_RES=($(redis-cli -h redis-mailcow --raw GET F2B_RES))
+    F2B_RES=($(timeout 4s redis-cli -h redis-mailcow --raw GET F2B_RES 2> /dev/null))
     if [[ ! -z "${F2B_RES}" ]]; then
       redis-cli -h redis-mailcow DEL F2B_RES > /dev/null
       host=
       for host in "${F2B_RES[@]}"; do
         log_msg "Banned ${host}"
         rm /tmp/fail2ban 2> /dev/null
-        timeout 2s whois ${host} > /tmp/fail2ban
-        sleep 2.5
+        timeout 2s whois "${host}" > /tmp/fail2ban
         [[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]] && [[ ${WATCHDOG_NOTIFY_BAN} =~ ^([yY][eE][sS]|[yY])+$ ]] && mail_error "${com_pipe_answer}" "IP ban: ${host}"
       done
     fi
diff --git a/docker-compose.yml b/docker-compose.yml
index 73c64ef3..a66a5078 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -366,7 +366,7 @@ services:
         - /lib/modules:/lib/modules:ro
 
     watchdog-mailcow:
-      image: mailcow/watchdog:1.55
+      image: mailcow/watchdog:1.56
       # Debug
       #command: /watchdog.sh
       build: ./data/Dockerfiles/watchdog