@Singleton @Configurable public class ExecCommand extends AbstractHealthAction
<health:HttpStatusHealthCheck ee:Named="httpStatusCheck">
<url>http://localhost:8080/test-ping.jsp</url>
</health:HttpStatusHealthCheck>
<health:ExecCommand>
<command>/opt/company/custom_command.sh</command>
<health:IfHealthCritical healthCheck="${httpStatusCheck}"/>
<health:IfRechecked/>
</health:Restart>
Modifier and Type | Class and Description |
---|---|
static class |
ExecCommand.HealthEnv |
Constructor and Description |
---|
ExecCommand() |
Modifier and Type | Method and Description |
---|---|
void |
addEnv(ExecCommand.HealthEnv env)
Add a custom env variable, system variable are available by default
|
HealthActionResult |
doActionImpl(HealthEvent healthEvent) |
java.lang.String |
getCommand() |
java.io.File |
getDir() |
java.util.Map<java.lang.String,java.lang.String> |
getEnv() |
long |
getTimeout() |
void |
init() |
void |
setCommand(java.lang.String command)
Set the command line to execute
|
void |
setDir(java.io.File dir)
Set the directory to execute from
|
void |
setTimeout(Period timeout)
Set the timeout on execution of the command, after which it will be killed
|
void |
setTimeoutMillis(long timeout) |
add, addListener, doAction, getPredicates, start, stop, toString
@PostConstruct public void init()
init
in class AbstractHealthAction
public java.lang.String getCommand()
@Configurable public void setCommand(java.lang.String command)
public java.io.File getDir()
@Configurable public void setDir(java.io.File dir)
public long getTimeout()
@Configurable public void setTimeout(Period timeout)
@Configurable public void setTimeoutMillis(long timeout)
@Configurable public void addEnv(ExecCommand.HealthEnv env)
public java.util.Map<java.lang.String,java.lang.String> getEnv()
public HealthActionResult doActionImpl(HealthEvent healthEvent) throws java.lang.Exception
doActionImpl
in class AbstractHealthAction
java.lang.Exception