Browse Source

pdns error handling added

84582af
Dirk Alders 1 year ago
parent
commit
737597bf3b
2 changed files with 14 additions and 5 deletions
  1. 8
    2
      pdns-get
  2. 6
    3
      pdns-proxy

+ 8
- 2
pdns-get View File

1
-#!/bin/sh
1
+#!/bin/bash
2
 #
2
 #
3
-wget -O - stdout http://pdns.mount-mockery.de 2> /dev/null|jq .$1
3
+IP=`wget -O - stdout http://pdns.mount-mockery.de 2> /dev/null|jq .$1`
4
+if [[ "$IP" = "null" ]]; then
5
+    echo No IP found for host $1.
6
+    exit 1
7
+else
8
+    echo $IP
9
+fi
4
 
10
 

+ 6
- 3
pdns-proxy View File

1
-#/bin/sh
1
+#/bin/bash
2
 #
2
 #
3
 HOST=`pdns-get $1`
3
 HOST=`pdns-get $1`
4
-socat stdio tcp:$HOST:22
5
-
4
+if [[ $? -eq 0 ]]; then
5
+    socat stdio tcp:$HOST:22
6
+else
7
+    >&2 echo CONNECTION ERROR: IP of host $1 is unknown. 
8
+fi

Loading…
Cancel
Save