Skip to content

Commit accce12

Browse files
committed
ANSWERED: Write a script to determine whether a host is up or down
1 parent 72ded52 commit accce12

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: README.md

+14
Original file line numberDiff line numberDiff line change
@@ -4799,6 +4799,20 @@ Using the keyword <code>read</code> so for example <code>read x</code> will wait
47994799

48004800
<details>
48014801
<summary>Write a script to determine whether a host is up or down</summary><br><b>
4802+
4803+
```
4804+
#!/bin/bash
4805+
SERVERIP=<IP Address>
4806+
4807+
4808+
ping -c 3 $SERVERIP > /dev/null 2>&1
4809+
if [ $? -ne 0 ]
4810+
then
4811+
# Use mailer here:
4812+
mailx -s "Server $SERVERIP is down" -t "$NOTIFYEMAIL" < /dev/null
4813+
fi
4814+
```
4815+
48024816
</b></details>
48034817

48044818
<details>

0 commit comments

Comments
 (0)