Skip to content
This repository was archived by the owner on Jun 12, 2024. It is now read-only.

Commit a1edd4c

Browse files
committed
[TASK] Update bash syntax for variables and conditions
1 parent ea69216 commit a1edd4c

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

templates/pdns/pdns_errors

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
command="/usr/bin/pdns_control list"
1717

18-
if [ "$1" = "autoconf" ]; then
18+
if [[ "$1" = "autoconf" ]]; then
1919
echo yes
2020
exit 0
2121
fi
2222

23-
if [ "$1" = "config" ]; then
23+
if [[ "$1" = "config" ]]; then
2424
echo 'graph_title Power DNS errors'
2525
echo 'graph_args -l 0 --base 1000'
2626
echo 'graph_vlabel numbers of'
@@ -41,5 +41,4 @@ if [ "$1" = "config" ]; then
4141
exit 0
4242
fi
4343

44-
45-
$command | sed 's/=\([0-9]\+\),/.value \1\n/g' | grep corrupt'\|'servfail'\|'timedout | sed 's/-/_/g'
44+
${command} | sed 's/=\([0-9]\+\),/.value \1\n/g' | grep corrupt'\|'servfail'\|'timedout | sed 's/-/_/g'

templates/pdns/pdns_latency

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
command="/usr/bin/pdns_control show"
1717

18-
if [ "$1" = "autoconf" ]; then
18+
if [[ "$1" = "autoconf" ]]; then
1919
echo yes
2020
exit 0
2121
fi
2222

23-
if [ "$1" = "config" ]; then
23+
if [[ "$1" = "config" ]]; then
2424
echo 'graph_title Power DNS latency'
2525
echo 'graph_args -l 0'
2626
echo 'graph_vlabel usec'
@@ -32,7 +32,4 @@ if [ "$1" = "config" ]; then
3232
exit 0
3333
fi
3434

35-
36-
37-
38-
echo "latency.value $($command latency | awk -F= '{print $2}')"
35+
echo "latency.value $(${command} latency | awk -F= '{print $2}')"

templates/pdns/pdns_qsize

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
command="/usr/bin/pdns_control show"
1717

18-
if [ "$1" = "autoconf" ]; then
18+
if [[ "$1" = "autoconf" ]]; then
1919
echo yes
2020
exit 0
2121
fi
2222

23-
if [ "$1" = "config" ]; then
23+
if [[ "$1" = "config" ]]; then
2424
echo 'graph_title Power DNS database queue'
2525
echo 'graph_args -l 0'
2626
echo 'graph_vlabel number of waiting queries'
@@ -32,5 +32,5 @@ if [ "$1" = "config" ]; then
3232
exit 0
3333
fi
3434

35-
echo "qsize.value $($command qsize-q)"
35+
echo "qsize.value $(${command} qsize-q)"
3636

templates/pdns/pdns_queries

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
command="/usr/bin/pdns_control list"
1717

18-
if [ "$1" = "autoconf" ]; then
18+
if [[ "$1" = "autoconf" ]]; then
1919
echo yes
2020
exit 0
2121
fi
2222

23-
if [ "$1" = "config" ]; then
23+
if [[ "$1" = "config" ]]; then
2424
echo 'graph_title Power DNS queries'
2525
echo 'graph_args -l 0 --base 1000'
2626
echo 'graph_vlabel numbers of'
@@ -53,5 +53,4 @@ if [ "$1" = "config" ]; then
5353
exit 0
5454
fi
5555

56-
57-
$command | sed 's/=\([0-9]\+\),/.value \1\n/g' | grep udp-'\|'recursing'\|'tcp | sed 's/-/_/g'
56+
${command} | sed 's/=\([0-9]\+\),/.value \1\n/g' | grep udp-'\|'recursing'\|'tcp | sed 's/-/_/g'

0 commit comments

Comments
 (0)