Class ScriptRunnerUnix
java.lang.Object
org.eblocker.server.common.system.unix.ScriptRunnerUnix
- All Implemented Interfaces:
ScriptRunner
Runs a script with a sudo wrapper.
Since we can not send the SIGTERM signal to the script in order to stop it (the script runs as root, this server does not), we need a special kill script.
-
Constructor Summary
ConstructorsConstructorDescriptionScriptRunnerUnix(String scriptWrapperPath, String killProcessCommand, Executor executor) -
Method Summary
Modifier and TypeMethodDescriptionintRuns a script.startScript(String scriptName, String... arguments) Starts a script.voidstopScript(LoggingProcess loggingProcess) Stops a script
-
Constructor Details
-
ScriptRunnerUnix
-
-
Method Details
-
runScript
public int runScript(String scriptName, String... arguments) throws IOException, InterruptedException Description copied from interface:ScriptRunnerRuns a script. This method waits for the script to terminate.- Specified by:
runScriptin interfaceScriptRunner- Parameters:
scriptName- name of the script- Returns:
- return value of the script. Usually, a zero exit value indicates success, while non-zero values indicate failure.
- Throws:
IOExceptionInterruptedException
-
startScript
Description copied from interface:ScriptRunnerStarts a script. NOTE: you are responsible for calling stopScript(), otherwise there will be two threads leaking per call!- Specified by:
startScriptin interfaceScriptRunner- Returns:
- the running LoggingProcess
- Throws:
IOException
-
stopScript
Description copied from interface:ScriptRunnerStops a script- Specified by:
stopScriptin interfaceScriptRunner- Parameters:
loggingProcess- the process to be stopped- Throws:
IOExceptionInterruptedException
-