Network checking while running a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Network checking while running a script
# 1  
Old 06-25-2009
Computer Network checking while running a script

hi,

i am new to this scripting stuff so please help.
i need a script that should check network connection while process.bsh is running which connects to a server for some time (e.g. 30 secs to a minute) and I wanted to make sure that network interruption does not happen during this time period to prevent data loss.

How should my script look like?
Is there a way that i could do the network check while process.bsh is still running?
# 2  
Old 06-25-2009
try this code

Code:
MACHINE=10.0.0.1 # Change to what ever you need
PORT=23 
exec 3>/dev/tcp/${MACHINE}/${PORT}
if [ $? -eq 0 ]
then
    echo "server accepting connections on $PORT port"
else
    echo "server connections not possible $PORT port"
fi

# 3  
Old 06-25-2009
yes.
but i meant WHILE process.bsh executes?

process queries from 10.0.0.1,for example, returning results every min.
how do i detect interruptions during this minute and prompting that there had been such interruption?

or am i just over-thinking things?
Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Checking to see if windows service is running

Hi I have created a PowerShell script which successfully checks whether windows service pgsql-9.2 is running. I have tried to call that PowerShell script with a shell/bash script within a LINUX machine but have been unsuccessful. Is there a way of a shell/Perl script to check whether a... (5 Replies)
Discussion started by: simpsa27
5 Replies

2. Solaris

Checking if service is running

Hi, For audit reasons, I need to stop the web server service in some Solaris servers. The port that is listening for this service is port 10000. This is the output that shows the port 10000 is open in the server : # netstat -an | grep 10000 10.70.21.144.10000 10.70.21.133.58130 49640... (6 Replies)
Discussion started by: anaigini45
6 Replies

3. Solaris

New to Solaris (Checking/Adding network and harddisk)

Hi all, As per the topic goes, q1) how do i check remotely (over ssh) - how many physical network interfaces I really have ? -- if an interface exists before and it got plug out, it must not be show again. -- i tried dladm show-link and ifconfig -a, but it seems to show a previously... (4 Replies)
Discussion started by: javanoob
4 Replies

4. UNIX for Dummies Questions & Answers

FIFO Status Checking/Running

May i please know 1) How to check if FIFO process is down? 2) How to bring FIFO up and running? we are using redhat Linux OS and bash shell Thank you. (1 Reply)
Discussion started by: Ariean
1 Replies

5. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

6. Shell Programming and Scripting

Shell Script for continuously checking status of a another script running in background, and immedia

Hi, I want to write a script which continuously checking status of a script running in background by nohup command. And if same script is not running then immediately start the script...please help.. i am using below command to run script nohup system_traps.sh & but in some... (9 Replies)
Discussion started by: ketanraut
9 Replies

7. Solaris

No network cable But Network interface is UP and Running

I've one Netra 240 After changing main board and system configuration card reader, Network is not accessible any more, Network interfaces are always UP and Running even when there is no cable connected to Network interfaces. I tried to restart and plumb/unplumb with no luck. ifconfig -a... (7 Replies)
Discussion started by: samer.odeh
7 Replies

8. Shell Programming and Scripting

checking to see if a service is running in a shell script

How can I tell, in a shell script, if a certain service is running? I know how to do this on the command line, but not in a script. Is an error thrown somehow that I can check? Thanks. (6 Replies)
Discussion started by: daflore
6 Replies

9. UNIX for Dummies Questions & Answers

perl scripting for checking if a process is running

Hi All, I am new to perl and have been trying to write a short script to check a process.Though i havent reached to the stage where i can match the output. I am trying to pass a variable x with value /opt/RGw/csbp-base/CSBP_BAT.01.00.05/csbp_BAT.01.00.05.jar and then pass another variable... (2 Replies)
Discussion started by: pistachio
2 Replies

10. UNIX for Dummies Questions & Answers

daemon running in AIX checking

how do u check if a daemon is running in AIX.. Is it ps -ef|grep daemon lssrc -s demon ??? Thanks! (0 Replies)
Discussion started by: karthikosu
0 Replies
Login or Register to Ask a Question