Service resources triggers¶
Triggers are scripts or commands executed before or after a resource action.
In a service resource configuration section, triggers can be defined using a keyword formatted as
[blocking_]<when>_<action>[@<scope>] = <command>
blocking_ prefix is set, a non-zero command return code causes the service action to abort on error.
blocking_ prefix is not set, a non-zero command return code causes an error log, but the service action continues.
preThe command is executed before the normal resource driver action.
postThe command is executed after the normal resource driver action.
The command value supports shell expressions, like
; is interpreted as a comment begin marker if preceded by a whitespace. To use this character as a separator between commands, be sure to not insert a whitespace before. Example:
post_start = echo hey; echo ya is valid but
post_start = echo hey ; echo ya is not.
pre_starttrigger to implement a wait loop for a tiers service expected state. A
blocking_pre_starttrigger can be combined with a wait loop timeout to abort the service startup if the required tiers service does not reach the expected state in time.
post_provisiontrigger to create directories, files, run configuration management, deploy app, ... just after the filesystems are provisioned and started.
Extra start checks
blocking_pre_starton the first started resource to verify extra conditions to allow service instance startup.