You can separate the commands using a command line separator, but with many such commands, it's difficult to read the resulting ant task. I've added an extension that lets you nest <command> subelements to the sshexec task, which cleans up this process. New class is called SSHExecMultiple for this task. ...Andrzej
Created attachment 15549 [details] Sample code for SSHExecMultiple
Sample usage for testing of sshexecmultiple: <target name="test-sshmultiple"> <echo>Starting sshexecmultiple test...</echo> <!-- sshexecmultiple lets you nest multiple commands and will execute them in sequence. Attributes are the same as for the base sshexec, with the addition of the haltonerror attribute. If haltonerror = "true" then if any command fails, subsequent commands will not be executed. If haltonerror = "false" then if any command fails, subsequent commands will STILL be executed. NOTE: The state is not preserved between the commands in this version. For example, if you change dirs in one command, this will no longer be in effect for the subsequent commands, as is demonstrated below. If you need to change state (ie directory) use semi-colons to separate multiple commands in a single <command> entry as is demonstrated below. --> <sshexecmultiple host="myhost" username="user" keyfile="mykeyfile" passphrase="lemmein" trust="true" haltonerror="false"> <command>echo One</command> <command>xyz</command> <command>echo Two</command> <command>pwd</command> <command>cd ..;pwd</command> <command>pwd</command> </sshexecmultiple> <echo>Done sshexecmultiple test</echo> </target>
-fixed in svn head using a FileResource, specify your commands in a seperate file eg. build.xml <sshexec host="ip" port="22" username="root" password="" commandResource="my-commands" failonerror="true" trust="true"/> my-commands: touch 1.txt mv 1.txt 2.txt mv 2.txt 3.txt