hierynomus / hierynomus/sshj

How to capture ssh.connect("host") & ssh.authPassword("username", "password"); exit codes whether it is success or not..

Open
#633 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.7k
Forks
620
Avg merge
3d 23h
Merged PRs (30d)
11

Description

I am following the below code to connect SFTP to put the file there..

How to capture ..SSHClient ssh = new SSHClient(); AND ssh.authPassword("username", "password"); commands exit codes?

my requirement is periodically check SFTP connection between source server to destination server.. I think we can create boolean variable as flag and assign the exit code to that flag (True or False).. Could you please suggest me?

ssh.connect("host");
try {
ssh.authPassword("username", "password");
SFTPClient sftp = ssh.newSFTPClient();
try {
sftp.put(new FileSystemFile("/path/of/local/file"), "/path/of/ftp/file");
} finally {
sftp.close();
}
} finally {
ssh.disconnect();
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.