Im trying to measure bandwidth, packet loss, latency and jitter between two computers on a wireless 802.11s mesh connection.
Im trying to make a (my first) bash script that can do the following:
- SSH to another computer and start logging data from services (
ptpd
,tcpdump
,iperf
). - Start the same processes on my own computer and start logging data.
- Once the
iperf
transmission on my own computer is finished, it should SSH into the remote computer and kill the the services.
The idea is for this these three steps run in a for-loop, that increases the package size transmitted by iperf for each iteration and logs the resulting data.
I know how to start a process on the remote pc by ssh host@adress process
.
I am however clueless on how to start multiple processes through SSH and logout, since the processes are terminated once I logout. I have looked at the screen
and nohup
commands, but don't know how to use them in a script.
Thanks in advance!
EDIT:
Thanks for all the help so far.
I got nohup to work now, it was pretty simple as people pointed out.
So now I got: ssh host@adress nohup ./script.sh > /dev/null 2>&1 &
in the script on my main pc.
This starts a script on the remote pc just fine, and then logout of SSH. The next problem is how to execute the script on the remote pc as sudo, since this is needed by tcpdump.
Trying ssh host@adress **sudo** nohup ./script.sh > /dev/null 2>&1 &
doesnt work.
Any ideas?
EDIT 2:
If anybody is stuck with the same problem, I found a guide how to solve this:
http://www.pantz.org/software/ssh/using_ssh_and_sudo_instead_of_root_for_remote_commands.html