Skip to content

Commit

Permalink
Added pgrep install
Browse files Browse the repository at this point in the history
Changed method to test if haproxy is running
Forced pid override at loop start
  • Loading branch information
acaranta committed Apr 25, 2021
1 parent 543ba58 commit 78f8ca7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND noninteractive
ENV INITRD No

RUN apt-get update -y
RUN apt-get install --force-yes -y haproxy inotify-tools python-pip curl lua-socket lua-json lua-http rsync
RUN apt-get install --force-yes -y haproxy inotify-tools python-pip curl lua-socket lua-json lua-http rsync pcregrep
RUN pip install envtpl supervisor supervisor-logging

#Fetch and build haproxy from github, compile it with prometheus exporter
Expand Down
10 changes: 8 additions & 2 deletions inotifreload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ echo "$(date) - Starting inotify loop"
while true; do
RELOAD=0
#Check if haproxy is still running
if ! kill -0 $(cat /run/haproxy.pid) ; then
haproxy -f /etc/haproxy/haproxy.cfg -f /etc/haproxy/$HASVC -D -p /run/haproxy.pid
# if ! kill -0 $(cat /run/haproxy.pid) ; then
# haproxy -f /etc/haproxy/haproxy.cfg -f /etc/haproxy/$HASVC -D -p /run/haproxy.pid
# fi
if ! pgrep haproxy ; then
haproxy -f /etc/haproxy/haproxy.cfg -f /etc/haproxy/$HASVC -D -p /run/haproxy.pid
else
pgrep haproxy >/run/haproxy.pid
fi

#start an inotifywait (timeout -s <#> seconds)
# inotifywait -t 10 -q -e close_write,moved_to,create /hacfg/$HASVC 2>&1 >/dev/null
if [ -d /hacfg/certs ]; then
Expand Down

0 comments on commit 78f8ca7

Please sign in to comment.