com.caucho.health.action
Class ExecCommand

java.lang.Object
  extended by com.caucho.health.action.AbstractHealthAction
      extended by com.caucho.health.action.ExecCommand
All Implemented Interfaces:
HealthAction

@Singleton
@Configurable
public class ExecCommand
extends AbstractHealthAction

Health action to execute a shell command.

<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>
 


Nested Class Summary
static class ExecCommand.Env
           
 
Constructor Summary
ExecCommand()
           
 
Method Summary
 void addEnv(ExecCommand.Env env)
          Add a custom env variable, system variable are available by default
 void 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)
           
 
Methods inherited from class com.caucho.health.action.AbstractHealthAction
add, addListener, doAction, getPredicates, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExecCommand

public ExecCommand()
Method Detail

init

@PostConstruct
public void init()
Overrides:
init in class AbstractHealthAction

getCommand

public java.lang.String getCommand()

setCommand

@Configurable
public void setCommand(java.lang.String command)
Set the command line to execute


getDir

public java.io.File getDir()

setDir

@Configurable
public void setDir(java.io.File dir)
Set the directory to execute from


getTimeout

public long getTimeout()

setTimeout

@Configurable
public void setTimeout(Period timeout)
Set the timeout on execution of the command, after which it will be killed


setTimeoutMillis

@Configurable
public void setTimeoutMillis(long timeout)

addEnv

@Configurable
public void addEnv(ExecCommand.Env env)
Add a custom env variable, system variable are available by default


getEnv

public java.util.Map<java.lang.String,java.lang.String> getEnv()

doActionImpl

public void doActionImpl(HealthEvent healthEvent)
Specified by:
doActionImpl in class AbstractHealthAction