I have to disconnect without executing a shell script via SSG and waiting for the script to be completed. Completing the script can take a long time, so I will create additional Java code to check the results from the script periodically. How can I disconnect the sshj session without waiting for the shell script to be completed?
After submitting that command (for example, submit the command and then call and the Java code will look something like this: & amp; . Example:
NOhup / USR / Bin / Langering Process & amp;
command.joint (), you can disconnect, And
longRunningProcess will continue in the background. The second thing to worry about is the output of the command. You can see the
stdout and
stderr elsewhere, such as
/ dev A file of / null has to be redirected. Therefore, the command will look something like this:
nohup / user / bin / loudgrading Action & gt; / Dev / null 2 & gt; and 1 & amp;
SSHClient Client = ... Wait for the session command = ... command command = submit the session.exec (yourCommand); // command. // Check the command.GetXtxtStatus () Check some error ... // session disconnect Closed (); client.close ();
No comments:
Post a Comment