The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Mount a remote file system mirciulicai SUN Solaris 4 05-30-2008 09:54 PM
File system and disc mount ailnilanjan SUN Solaris 7 02-06-2008 09:34 AM
how to mount a file system of a remote machine to local file system cy163 UNIX for Dummies Questions & Answers 2 01-31-2008 09:04 AM
System usage check pushkar.verma AIX 3 01-25-2008 02:11 PM
How to mount/make a FAT system on Linux kyoist Filesystems, Disks and Memory 2 10-23-2005 02:37 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-01-2005
ust ust is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 98
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.
  #2 (permalink)  
Old 04-01-2005
Sergiu-IT's Avatar
Sergiu-IT Sergiu-IT is offline
Registered User
  
 

Join Date: Mar 2005
Location: Transilvania
Posts: 133
Quote:
Originally Posted by ust
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.
Hi !
I have kinda same problem, and for that I've maked a simple bash script that will send a ping to each computer in the network. It sends the ping, if the ping is ok, it says "OK", else it beeps and it says "HOST IS DOWN". I have done all this in a while loop, and at the end of the while I put the 'sleep 20' command to wait 20 seconds before the next set of pings...
Try something like this changing the timeout to 3600 seconds or so...
I hope it helped...
bye !
  #3 (permalink)  
Old 04-01-2005
ust ust is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 98
thx reply , do you mind post the script ? thx
  #4 (permalink)  
Old 04-01-2005
Sergiu-IT's Avatar
Sergiu-IT Sergiu-IT is offline
Registered User
  
 

Join Date: Mar 2005
Location: Transilvania
Posts: 133
No, I don't mind at all, only that I don't have it at home, only at work.
Anyway, here is a script that looks like it.
Code:
#! /bin/sh

for ip in `cat file.txt`
do
    ping -c 1 $ip > /dev/null
    if [ $? -gt 0 ]; then echo -e "Host is down !\a";
       else echo -e "Host is alive !"
    fi
    sleep 20;
done
The script that I use at work is a much complex, but this is the ideea... You can change it a little bit to send the message to /dev/console also or wherever you think you need it... or even in a file...
The file.txt is a file where you have the list of IPs to ping, one IP on each line.
And... by the way, it is a for loop, not while like I sayd before... .

I hope it's usefull...
Bye !

Last edited by Sergiu-IT; 04-01-2005 at 07:24 PM..
  #5 (permalink)  
Old 04-02-2005
ust ust is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 98
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
  #6 (permalink)  
Old 04-02-2005
Sergiu-IT's Avatar
Sergiu-IT Sergiu-IT is offline
Registered User
  
 

Join Date: Mar 2005
Location: Transilvania
Posts: 133
Quote:
Originally Posted by ust
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
Oh, It seems that I missunderstood you. Sorry. Anyway, I don't know if you can do this by scripts... probably if you'll give me some more details I can think about it.
But why don't you try to make a simple C program. Using sockets is not so difficult and that will be a much "professional" solution
Sorry I couldn't help you...
Bye !
  #7 (permalink)  
Old 04-02-2005
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,209
Can you at least indicate what OS you are using here, and what way the filesystem is mounted (what options are used)
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0