1834022 Members
2291 Online
110063 Solutions
New Discussion

check the system mount

 
SOLVED
Go to solution
peterchu
Super Advisor

check the system mount

I have a system mount between , but sometimes the connection will be broken because the network unstable , so that some process will be fail to run , it will cause some problems to us , could suggest is there any method that I will be informed once connection is lost ? or could suggest any script that can check ( eg. every hour ) the connection is normal or not ? thx in advance.
4 REPLIES 4
Steven E. Protter
Exalted Contributor
Solution

Re: check the system mount

ping -n 1 -m 30

# This will send one ping packet and wait 30 seconds for a reply

# get the return code
rc=$?

if [ $rc -ne 0 ]
then
echo "WAKE UP THE SYSADMIN"
fi

Put what action you want the system to take in the if/fi loop.

If this is nfs, try soft links they tend to survive network congestion better.

A common cause of this is network congestion. If possible, consider a private network or VLAN between the boxes. Any time there is a windows box on the same collision domain as a NFS connection there is a liklihood of congestion that will interfere with operation of the NFS connection.

Same thing may apply to Samba.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Biswajit Tripathy
Honored Contributor

Re: check the system mount

Something like (not tested. syntax error might
be there):

while [ /bin/true ]
do
ping REMOTE_MACHINE -n 1 | grep -q "100% packet loss"
if [ $? -eq 0 ]
then
mailx -s "Machine down" email@company.com << EOF
REMOTE_MACHINE down
EOF
fi
sleep 3600
done

- Biswajit

:-)
Biswajit Tripathy
Honored Contributor

Re: check the system mount

Steven's solution has one small issue. On HP-UX,
ping returns 0 if it can resolve the hostname, does
not matter if the machine is up or down i.e ping
reports 0% or 100% packet loss. The return value
would be nonzero only if the host is unknown or
unreachable.

- Biswajit
:-)
peterchu
Super Advisor

Re: check the system mount

thx all replies ,

I know ping can check whether host is exist or not , however , what my problem is sometimes the host is exist but the mount connection is lost between two servers , I just want to make sure the mount is connected ,

The above script seems only check the remote host is exist or not , but can't know the status of the system mount , could suggest what can I do ? thx