File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -21,24 +21,24 @@ If you're using Maven, that looks like this:
21
21
</dependency >
22
22
```
23
23
If you're using Gradle, that looke like this:
24
- ```
24
+ ``` gradle
25
25
implementation group: 'io.github.DarkAssassinator', name: 'ssh-spring-boot-starter', version: '1.0.0'
26
26
```
27
27
Next, you can instantiate a SSH Session pool like
28
- ```
28
+ ``` java
29
29
@Autowired
30
30
private SshSessionPool sessionPool;
31
31
```
32
32
Then you should create a SSH Session Host Entity named ` SshSession ` . See the example below:
33
- ```
33
+ ``` java
34
34
SshSession sshSession = new SshSession ();
35
35
sshSession. setIp(" xx.xx.xx.xx" );
36
36
sshSession. setPort(22 );
37
37
sshSession. setAccount(" root" );
38
38
sshSession. setPassword(" this is a password" );
39
39
```
40
40
Next, you can borrow a session holder from SessionPool.
41
- ```
41
+ ``` java
42
42
SshSessionHolder sessionHolder = null ;
43
43
try {
44
44
sessionHolder = sessionPool. getSessionHolder(sshSession);
49
49
}
50
50
```
51
51
How to execute shell command:
52
- ```
52
+ ``` java
53
53
sessionHolder. execCommand(" echo 'hello world'" );
54
54
```
55
55
You can’t perform that action at this time.
0 commit comments