Reputation: 837
Basically I've got 2 sshexec tasks in an ant target, one after the other. The first one launches a message sender on one machine, and the second one launches a message receiver on a different machine. I was assuming that the sshexec task will issue the command to run the message sender, and then return while the sender is running, and then the following sshexec task would start the receiver, and thus both sender and receiver would be running in parallel, which is what I hope to achieve, but I'm not sure if this is actually the case, or if in fact the first task will only return when the sender returns, and thus the receiver will only get started after the sender has finished executing.
The sshexec task page doesn't seem to offer much info, and I'm somewhat new to mac ( the commands are being issued on mac minis running macos 10), so any help would be greatly appreciated, thanks!
<!--start sender-->
<sshexec host="${ip.client3}"
username="${username}"
password="${userpassword}"
trust="true"
command="./sender"
/>
<!-- start receiver-->
<sshexec host="${ip.client4}"
username="${username}"
password="${userpassword}"
trust="true"
command="./receiver "
/>
Upvotes: 0
Views: 1702
Reputation: 2739
<sshexec>
task will return after the remote command returns.
If you just want the two commands to start at the same time, you can use <parallel>
task. Any task nested in <parallel>
task will run "at the same time" by multi threading. However, in this way, <sshexec>
still need to wait for the two commands to return.
If you just want your ant script to launch those two commands and continue building without waiting for remote commands to return, you may use things like nohup
in your commandline.
I am not sure if nohup works, because when I run a remote command from a ssh terminal with nohup like this:
nohup command & [ENTER]
I have to press enter again before I start to use the same terminal to do something else.
Upvotes: 2