Reputation: 30436
I have an ant build script that connects to a remote server and kicks off a local build using SSHExec. This build takes approximately 1 minute and it sends me an email when it's completed, but the ant task I have:
<sshexec
host="${deploy.host}"
username="${deploy.username}"
trust="true"
keyfile="${user.home}/.ssh/id_rsa"
command="~/updateGit.sh"/>
Will wait until the script is completed. I tried passing a &
like so (I assume I have to escape it in a build.xml):
<sshexec
host="${deploy.host}"
username="${deploy.username}"
trust="true"
keyfile="${user.home}/.ssh/id_rsa"
command="~/updateGit.sh &"/>
But this doesn't seem to make a difference. In case this extra detail helps anyone, the script generates a lot of output and a slow internet connection can cause the script to take a lot longer (as it's output is being piped back, the assumption with this approach is that I only care about the output after its done, so if I pack it up into an email I can monitor my inbox as builds get kicked off, basically it's a poor-man's Continuous Integration)
Upvotes: 1
Views: 7713
Reputation: 30436
Using information from this answer (and the nohup
command) I updated my task as follows:
<sshexec
host="${deploy.host}"
username="${deploy.username}"
trust="true"
keyfile="${user.home}/.ssh/id_rsa"
command="nohup ~/updateGit.sh > /dev/null 2> error.log < /dev/null &"/>
Upvotes: 2