summaryrefslogtreecommitdiffstats
path: root/arch/calvin/trinity-qt3/189checkservices.sh
blob: bca50c93d3ced22619c7a9e2e230ecc6c743d3e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash

IP_ADDRESS_1=97.64.229.82
IP_ADDRESS_2=97.64.229.83

STATUS_1=0
STATUS_2=0

CURDATE=$('date')

netcat -z ${IP_ADDRESS_1} 80
if [ $? -eq 0 ]
then
    STATUS_1=1
else
    sleep 5
    netcat -z ${IP_ADDRESS_1} 80
    if [ $? -eq 0 ]
    then
        STATUS_1=1
    else
        echo "Interface 1 is DOWN"
    fi
fi

netcat -z ${IP_ADDRESS_2} 80
if [ $? -eq 0 ]
then
    STATUS_2=1
else
    sleep 5
    netcat -z ${IP_ADDRESS_2} 80
    if [ $? -eq 0 ]
    then
        STATUS_2=1
    else
        echo "Interface 2 is DOWN"
    fi
fi

if [[ STATUS_1 == 0 ]]; then
    mail -s "[SERVICE FAILURE NOTIFICATION] pearsoncomputing.net" kb9vqf@pearsoncomputing.net < "The network interface ${IP_ADDRESS_1}:80 failed to respond on ${CURDATE}"
fi

if [[ STATUS_2 == 0 ]]; then
    mail -s "[SERVICE FAILURE NOTIFICATION] pearsoncomputing.net" kb9vqf@pearsoncomputing.net < "The network interface ${IP_ADDRESS_2}:80 failed to respond on ${CURDATE}"
fi