Execute Shell Scripts at a Remote Host

Hi

I need to execute few Shell Scripts which live at a remote machine. As of now, am using a third party library (JSch). I just got introduced to Shell-Task. Can I use this to connect to a remote host and then execute the script there by passing some arguments ?

As of now , the code in my Service-Task class looks like this : -

                     JSch jsch=new JSch(); 
		 jsch.addIdentity("/root/.ssh/id_rsa"); // Private Key path, so that password is not needed
		 Session session=jsch.getSession(userName,"HostName");
		 java.util.Properties config = new java.util.Properties(); 
		 config.put("StrictHostKeyChecking", "no");
		 session.setConfig(config);
		 session.connect();
		 Channel channel = session.openChannel("exec");
	                 ChannelExec channelExe = (ChannelExec) channel;
                     channelExe.setCommand(scriptPath+arguments);

Hi,

The shell task logic executes the commands locally on the server running the Flowable Engine. You can always override the default Shell task behavior class with your own implementation.

Best regards,

Tijs

Thanks @tijs. I take it as a :+1: for my implementation :).

Regards
Vinay

Hi Vinay,

Indeed :slight_smile:

Best regards,

Tijs