質問編集履歴
2
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,32 +22,36 @@
|
|
22
22
|
|
23
23
|
### 試したこと
|
24
24
|
|
25
|
-
`
|
25
|
+
```bash
|
26
26
|
|
27
|
+
#!/bin/sh
|
28
|
+
|
27
|
-
|
29
|
+
IP_ADDR_ARRAY="IPアドレス";
|
28
30
|
|
29
31
|
|
30
32
|
|
31
|
-
|
33
|
+
NUM=0
|
32
34
|
|
33
|
-
|
35
|
+
for IP in ${IP_ADDR_ARRAY[@]}
|
34
36
|
|
35
|
-
|
37
|
+
do
|
36
38
|
|
37
|
-
|
39
|
+
ping ${IP} -c 1 >> /dev/null
|
38
40
|
|
39
|
-
|
41
|
+
if [ $? == 0 ] ;
|
40
42
|
|
41
|
-
|
43
|
+
then
|
42
44
|
|
43
|
-
|
45
|
+
echo "OK"
|
44
46
|
|
45
|
-
|
47
|
+
else
|
46
48
|
|
47
|
-
|
49
|
+
echo "NG" | echo "NG" | mail -s "Alert of server down" -S smtp=SMTPサーバ -r 送信元アドレス 送信先アドレス
|
48
50
|
|
49
|
-
|
51
|
+
fi
|
50
52
|
|
51
|
-
|
53
|
+
NUM=expr ${NUM} + 1
|
52
54
|
|
53
|
-
done
|
55
|
+
done
|
56
|
+
|
57
|
+
```
|
1
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,34 +22,32 @@
|
|
22
22
|
|
23
23
|
### 試したこと
|
24
24
|
|
25
|
+
`#!/bin/sh`
|
25
26
|
|
26
|
-
|
27
|
-
!/bin/sh
|
28
|
-
|
29
|
-
IP_ADDR_ARRAY="IPアドレス";
|
27
|
+
`IP_ADDR_ARRAY="IPアドレス";`
|
30
28
|
|
31
29
|
|
32
30
|
|
33
|
-
NUM=0
|
31
|
+
`NUM=0`
|
34
32
|
|
35
|
-
for IP in ${IP_ADDR_ARRAY[@]}
|
33
|
+
`for IP in ${IP_ADDR_ARRAY[@]}`
|
36
34
|
|
37
|
-
do
|
35
|
+
`do`
|
38
36
|
|
39
|
-
ping ${IP} -c 1 >> /dev/null
|
37
|
+
`ping ${IP} -c 1 >> /dev/null`
|
40
38
|
|
41
|
-
if [ $? == 0 ] ;
|
39
|
+
`if [ $? == 0 ] ;`
|
42
40
|
|
43
|
-
then
|
41
|
+
`then`
|
44
42
|
|
45
|
-
echo "OK"
|
43
|
+
`echo "OK"`
|
46
44
|
|
47
|
-
else
|
45
|
+
`else`
|
48
46
|
|
49
|
-
echo "NG" | echo "NG" | mail -s "Alert of server down" -S smtp=SMTPサーバ -r 送信元アドレス 送信先アドレス
|
47
|
+
`echo "NG" | echo "NG" | mail -s "Alert of server down" -S smtp=SMTPサーバ -r 送信元アドレス 送信先アドレス`
|
50
48
|
|
51
|
-
fi
|
49
|
+
` fi`
|
52
50
|
|
53
|
-
NUM=
|
51
|
+
` NUM=expr ${NUM} + 1
|
54
52
|
|
55
|
-
done
|
53
|
+
done`
|