I'm trying to write a shell script on Ubuntu 16.04 that will execute a command on another machine remotely, then execute more commands locally. I've tried this and it doesnt work
#!/bin/bash
ssh username@10.200.31.131 'pkill iperf'
ssh -f username@10.200.31.131 'iperf -s'
iperf -c 10.150.91.175 >iperflog.txt
It will execute the first 2 commands on the remote server but I think it is also trying to execute the last command on the remote server as well and I want to execute the last one on the local server. How can I do this? Thanks
Perhaps your command stay Logged In!
Try to add a ; /bin/bash
; /bin/bash
to the end of your command line on the remote side
ssh username@10.200.31.131 'pkill iperf; /bin/bash -i'
i hope help you
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.