Find the answer to your Linux question:
Results 1 to 2 of 2
I've got two asterisk servers that I run tcpdump on in order to sip trace. Currently I use this command to capture the packets. ssh root@astbox01 'tcpdump -w - -p ...
  1. #1
    Just Joined!
    Join Date
    Aug 2009
    Posts
    1

    simultaneous SSH with bash scripting

    I've got two asterisk servers that I run tcpdump on in order to sip trace.

    Currently I use this command to capture the packets.

    ssh root@astbox01 'tcpdump -w - -p -n -s 0 udp' > capture01.cap

    Problem is, I have to open up two terminal windows and run my script twice, one for box01 and the other for box02

    When I am done the test call, i ctrl+C to exit.

    What I want to do is simultaneously run this command on both boxes, with a way to quit both at the same time.

    It would be great if I could hard code the passwords into the script as well but this is not necessary. The password is the same for both boxes.

    Thank you to all for taking time out of your day to help others.

  2. #2
    Just Joined!
    Join Date
    May 2008
    Posts
    14
    I not sure and can't test it, i'm under Windows now

    if ssh is auto login (ssh with no pass) , try this

    run
    ===============
    ssh root@box1_ip 'tcpdump -w - -p -n -s 0 udp > capture01.cap' &
    ssh toot@box2_ip 'tcpdump -w - -p -n -s 0 udp > capture01.cap' &


    stop
    ===============
    ssh root@box1_ip 'kill -9 $(pidof tcpdump)'
    ssh root@box2_ip 'kill -9 $(pidof tcpdump)'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...