LinuxCommandExecutor
Linux Command Executor Linux Command Executor Utility class to run linux commands from java application ProcessExecutor.java package com.codergists.util; import com.codergists.exception.ProcessExecutionException; import lombok.extern.slf4j.Slf4j; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import static java.lang.String.join; import static java.util.concurrent.TimeUnit.SECONDS; import static org.apache.logging.log4j.util.Strings.isEmpty; /** * ProcessExecutor to run list of commands and return success response. * <p> * This Singleton class executes array of commands on {@link Runtime} and wait for specified Time Period to get the * response back. * <p> * * @author tvajjala = ProcessExecutor.getInstance().execute("whoami");