For executing multiple commands in sequence, you can create a command string like below:
String script ="pbrun su - user; cd /home/scripts;./sample_script.sh”
Execute it and pass this string to your method above.
More Related Contents:
- Certain Unix commands fail with “… not found”, when executed through Java using JSch
- How to resolve Java UnknownHostKey, while using JSch SFTP library?
- How to read JSch command output?
- com.jcraft.jsch.JSchException: UnknownHostKey
- Providing input/subcommands to command executed over SSH with JSch
- Run a command over SSH with JSch
- Can we use JSch for SSH key-based communication?
- JSch Logs in files
- “Invalid privatekey” when using JSch
- Connect to remote MySQL database through SSH using Java
- JSchException: Algorithm negotiation fail
- How do I run SSH commands on remote system using Java? [closed]
- Multiple commands through JSch shell
- The cipher ‘aes256-cbc’ is required, but it is not available
- Sending commands to server via JSch shell channel
- Algorithm negotiation fail SSH in Jenkins
- What is the difference between the ‘shell’ channel and the ‘exec’ channel in JSch
- Skipping Kerberos authentication prompts with JSch [duplicate]
- Public key authentication fails with JSch but work with OpenSSH with the same key
- SFTP file transfer using Java JSch
- Getting unwanted characters when reading command output from SSH server using JSch
- Using Keys with JGit to Access a Git Repository Securely
- Java: Date from unix timestamp
- SSH library for Java [closed]
- How to set working directory with ProcessBuilder
- scp transfer via java
- RabbitMQ and relationship between channel and connection
- convert openSSH rsa key to javax.crypto.Cipher compatible format
- Is there a Java library of Unix functions?
- How do I transfer a file from one directory to another using Java SFTP Library JSch?