LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Simple question about command syntax ping/log ping results (https://www.linuxquestions.org/questions/linux-networking-3/simple-question-about-command-syntax-ping-log-ping-results-467377/)

ohalnet 07-25-2006 04:28 AM

Simple question about command syntax ping/log ping results
 
Hi all :)

I am new to linux and need help on a two simple issues. I'll really appreciate if you can help me.

Issue 1. On the command line window of red hat 8.0, I want to ping an IP address continuosly and log the ping results as text file. If it is possible, I want to execute both commands(ping and log) in the same line. What would be the correct command syntax? (I mean I need to execute both ping and log with one "ENTER")

PS: I have to see the ping reply packets on the screen while it is being logged at the same time.

Issue 2. I need to ping 20 IP addresses on 20 command line windows at the same time, log the ping results as well. In other words I need to do Issue one on 20 windows and 20 IP addresses. Could you help me how to create a script about do Issue 2 with one command?

command line window 1: pings and logs 192.168.1.1,
command line window 2: pings and logs 192.168.1.2,
...
...
command line window 10: pings and logs 192.168.1.10

Thank in advance for helping :)

nx5000 07-25-2006 04:46 AM

Something like this would be a start:
#!/bin/sh
ping $1 | tee /log/ping_$1


Use it like this:
script <ip>

There's also several tools that do it. oping for example.


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