it depends on how the server responds when executing your command. If the server print out some output while executing the command, you can use our Scripting API and use
Scripting.WaitFor(ScriptEvent.Prompt) method accordingly. Please see our Scripting feature pages to read more detail about it and how to use it.
If the server is "silent" when executing your command, you have to set
Ssh.Timeout to a greater value than the greatest expected execution time or set it to -1 to not timeout it at all. Then you have to use combination of
ScriptEvent.Promp and periodically check which one is matched. The ScriptEvent.Duration is necessary in this scenario because the server send no data and the Scripting API itself can time out when it process no data for a long period of time.
If you are not familiar with our Scripting API, please read the feature pages I mentioned above. If this answer is not enough for you, please provide more information about the issue to us.