0

I am attempting to automate throughput measurement of a WLAN using iperf ,so i have a script that will initiate the server (iperf -s -i1 -w2M -t300) and save the contents of the output,send an email and place file in a corporate directory. However, i still have to execute the client side remote command manually (iperf -c 192.168.0.150 -w2M -i1 -t300) .I want to execute one script for both task either by :-

a) Start an SSH process in the script and execute the command. b) Pass an iperf application signal to the remote PC that will induce a process execution.

Please note that by SSH, it will achieve my goal but it will defeat the purpose of my exercise, i want to do functions calling between two machines

I want to have a running application on both sides and the process executed on one.

#!/usr/bin/bash 
cwd=$(pwd)
export PATH=$PATH:$cwd
read -p "Name of the file" FXX
read -p "Number of minutes" MMM
iperf -s -i1 -w2M -t"$MMM" | tee "$FXX.txt"
source iperfserver
source /usr/bin/iperfserver
trap exit INT 
sshpass -p 'hello' scp "$FXX.txt" bharat@hello:
echo "Hello"|mailx -s "Hello " -a "$FXX.txt" bharat@hello.com

Here is the iperfserver script, so i am trying to coordinate the efforts between the scripts but i am not able to so as soon as i start iperf -s the script stops and i cannot create a simultaneous process. I will try to research on this but if you can help me i will be grateful.

#!/usr/bin/bash
cwd=$(pwd)
export PATH=$PATH:$cwd
sshpass -p 'hello' ssh 192.168.0.101
iperf -c 192.168.0.150 -w2M -i1 -t300

Thanks

Bharat C P

  • Guys, i might have found how to call a script just to be sure this post might be helpful. http://stackoverflow.com/questions/8352851/how-to-call-shell-script-from-another-shell-script – Bharat C Penumutchu Jan 14 '15 at 19:52
  • This link just explains how to call a script from within another, which is basic stuff and not really that relevant. – ShellFish Jan 14 '15 at 21:08
  • Can I ask why you won't use SSH, it's exactly it's purpose. Using another executable for the same result wouldn't really add purpose. Could you perhaps clarify what the exact purpose of your exercise is? – ShellFish Jan 14 '15 at 21:16
  • Well not using SSH is actually reinventing the wheel, when you program and script you usually reuse as much existing and tested code you can for portability and reliable execution. Anyway, I guess you could ftp a file and have a server side script check the content with a cron job but this seems like poor programming. You could also use NFS or sshfs. – ShellFish Jan 14 '15 at 21:30
  • Joshou and Dino thank you for you comments. I have done the same. – Bharat C Penumutchu Jan 16 '15 at 00:54

0 Answers0