Module: check_mk
Branch: master
Commit: 3788bd6b26f15c21734d6aaeb6ca1dd52b20d7e9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3788bd6b26f15c…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Thu Jul 11 11:21:00 2013 +0200
fixed pnp-templates/.f12: if no listener on lo:32000 it now still works
---
pnp-templates/.f12 | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/pnp-templates/.f12 b/pnp-templates/.f12
index 832634b..01e6d45 100644
--- a/pnp-templates/.f12
+++ b/pnp-templates/.f12
@@ -1,5 +1,11 @@
SITE=${SITE:-$(omd sites --bare | head -n 1)}
sudo cp * /omd/sites/$SITE/share/check_mk/pnp-templates
-echo 'location.reload();' | nc -w 0 localhost 32000
+
+# do nc to port 32000 only if there is someone listening
+# (otherwise complete f12 script breaks if no listener on 32000)
+if [ $(nmap -PN -p 32000 localhost | egrep "32000.*open" | wc -l) -gt 0 ]
+then
+ echo 'location.reload();' | nc -w 0 localhost 32000
+fi