From 400243cee02fedbb0bc5a8b444d70a884f84f745 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Fri, 28 Jul 2023 10:16:55 +0200
Subject: [PATCH] check existance of file $HAPROXYcfgfile

---
 inc_haproxy_cfg.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/inc_haproxy_cfg.sh b/inc_haproxy_cfg.sh
index 8aea4a4..d497baa 100755
--- a/inc_haproxy_cfg.sh
+++ b/inc_haproxy_cfg.sh
@@ -8,6 +8,7 @@
 # 2021-12-14  v1.0  <axel.hahn@iml.unibe.ch>  init
 # 2022-10-21  v1.1  <axel.hahn@unibe.ch>      remove grep: warning: stray \ before white space
 # 2023-06-09  v1.2  <axel.hahn@unibe.ch>      take first haproxy stats port on multiple binds
+# 2023-07-28  v1.3  <axel.hahn@unibe.ch>      check existance of file $HAPROXYcfgfile
 # ======================================================================
 
 # full path to haproxy.cfg
@@ -54,7 +55,7 @@ HAPROXYdoCache=0
 function cfgrewriter(){
   local _section=
   IFS=''
-  while read line
+  test -f $HAPROXYcfgfile && while read line
   do
     echo $line | grep "^[a-z]" >/dev/null
     if [ $? -eq 0 ]; then
-- 
GitLab