LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-13-2007, 07:06 AM   #1
horacioemilio
Member
 
Registered: Dec 2007
Posts: 61

Rep: Reputation: 15
Segmentation fault while doing 'ping'


Hi, I am trying to write a script with scans a list of nodes.

I did this, but when the nodes are not active, I get segmentation fault ! what could be the reason ?

Code:
#!/bin/bash

success="1 packets transmitted, 1 received, 0% packet loss, time 0ms"

for i in `seq $1 $2`
do
        # first it should be checked if the node exists !

        # second, we test if we get answer with the ping
         read test_string <<< $(ping -c1 -w1 node${i} | grep '1 received')
         echo $test_string
         if [[ ${test_string} = ${success} ]]
                 then
                        #echo $test_string
                        echo " node${i} seems to be active "
         fi 

        
done
 
Old 12-13-2007, 07:11 AM   #2
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
That your box is broken.

What Architecture/ Kernel/ Distribution is this?
 
Old 12-13-2007, 08:05 AM   #3
horacioemilio
Member
 
Registered: Dec 2007
Posts: 61

Original Poster
Rep: Reputation: 15
SuSE Linux 9.1 (i586)
VERSION = 9.1


Linux hostname 2.6.5-7.111.30-smp


cat /proc/cpuinfo




processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 3
model name : Intel(R) Xeon(TM) CPU 2.80GHz
stepping : 4
cpu MHz : 2801.376
cache size : 1024 KB
physical id : 0
siblings : 2
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fd
bogomips : 5521.40

processor : 1
vendor_id : GenuineIntel
cpu family : 15
model : 3
model name : Intel(R) Xeon(TM) CPU 2.80GHz
stepping : 4
cpu MHz : 2801.376
cache size : 1024 KB
physical id : 0
siblings : 2
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fd
bogomips : 5586.94

processor : 2
vendor_id : GenuineIntel
cpu family : 15
model : 3
model name : Intel(R) Xeon(TM) CPU 2.80GHz
stepping : 4
cpu MHz : 2801.376
cache size : 1024 KB
physical id : 3
siblings : 2
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fd
bogomips : 5586.94

processor : 3
vendor_id : GenuineIntel
cpu family : 15
model : 3
model name : Intel(R) Xeon(TM) CPU 2.80GHz
stepping : 4
cpu MHz : 2801.376
cache size : 1024 KB
physical id : 3
siblings : 2
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fd
bogomips : 5586.94
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ping : segmentation fault mad_hatter Linux - Wireless Networking 13 05-02-2007 05:16 AM
Segmentation fault mcamember Programming 7 12-18-2006 03:27 PM
yast segmentation fault, system freezing - nvidia driver at fault? BaltikaTroika SUSE / openSUSE 2 12-02-2005 09:34 AM
What is segmentation fault? koyi Programming 3 08-30-2003 12:03 AM
why am I getting 'segmentation fault' with this ? purpleburple Programming 4 09-04-2002 06:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration