Service checks

Service checks enables you to specify which applications you want to run before any service starts up, shuts down, or is aborted. Likewise, applications can be run before a particular service is started, stopped, or aborted. When running a service check before any service is started, you are validating all of the policies that are defined in the history_subscriptions.xml file for history logging.

About this task

When an application is run, it must return a 0 on success and a nonzero value on failure. If the application should fail before a service starts, the service will not start.

There are three types of service checks:
before_start
Runs before the service starts.
after_stop
Runs after the service stops.
after_abort
Runs after the service stops.
Currently only one check of each service type is supported. If multiple service types for the same purpose exist, only the last one is run.

Procedure

  1. Add a line to the [service.check all] section in the env_settings.ini file if you want a service check that runs for any service.
  2. Add a section that is called [service.checks <service name>], where <service name> is the name of one of the services from the [services] section if you want a service check that runs for a particular service. Then, add a line for the service check.
    Note: Refer to the comments in the [service.check all] section in the env_settings.ini.default file for restrictions on syntax and quoting.

Example

In this example, a service check runs before any service is started:

[service.check all]
before_start=my test –option=some arg

In this example, a service check runs before a service named appsvr2 starts:

[service.check appsvr2]
before_start=my test –option=some arg

In this example, two service checks run for a service named scheduler:

[service check scheduler]
after_abort: my_cleanup_script.sh
before_start: check_something.exe