This describes the intent and purpose of an Exit file.
An Exit file, such as default.exit, is intended to store a set of rules in which the controller will process on execution.
These are used to run some set of commands, such as shutting down a system.
An Exit is a special variation or subset of an Entry.
The settings item Object:
- Represents Exit settings and is not an
itemthat can be executed. - A number of settings are supported, but if this Item Object is not specified, then defaults are used.
-
The following settings are available:
pidandshow.The
definesetting:- Use this to define an environment variable (this overwrites any existing environment variable with this name).
- A define is both exported as an environment variable as well as exposed as an IKI variable.
- Example IKI variable substitution: for
define PATH /bin:/sbin, the associated IKI variable would look like:define:"PATH". - All environment variables, including those defined using this, must be in the
environmentlist in any given Rule to be exported to the executed process. - Environment variables added here that are not added to the environment are still exposed as an IKI variable.
- This is only expanded within any Rule operated on by this Exit.
The
modesetting:- Represents the mode in which the Exit is operating in.
-
The following modes are supported:
programandservice.The
programmode:- Designates that the Exit operates as a program and exits when complete.
- Will call the
exitwith the same name as this Exit, but with the extensionexit, such asdefault.exit. - Supports the Item Action
executeto execute a program (switching thecontrollerprogram entirely with the executed process).
The
servicemode:- Designates that the Exit operates as a service and will sit and wait for control commands when complete.
- Will call the
exitwith the same name as this Exit, but with the extensionexit, such asdefault.exit. - Does not support the Item Action
execute. - This is the default mode.
The
parametersetting:- Use this to define an IKI variable name and value.
- These do not conflict with environment variables and are not exposed as environment variables.
- Example IKI variable substitution: for
parameter hello world, the associated IKI variable would look like:parameter:"hello". - This is only expanded within any Rule operated on by this Exit.
The
pidsetting:- Represents how the Exit PID file is generated or not.
- The following modes are supported:
disable,require, andready. - For
disable, not PID file representing the Exit is created. - For
require, check to see if the PID file exists for an Exit at startup and then whenreadycreate a PID file, display error on PID file already exists or on failure and then fail. - For
ready, whenreadycreate a PID file, display error on failure and then fail (does not check if PID file exists).
The
showsetting:- Represents the way Exit processing presents information to the screen.
- This applies only to the Exit and Rule processing itself and does not handle the output of programs and scripts being executed by some Exit or Rule.
- The following show options are supported:
normalandinit. - For
normal, will not report the start or stop of some Exit or Rule execution but will report any errors or warnings as appropriate. - For
init, will report when starting programs and may include reporting success and failure status.
The
timeoutsetting:- Represents the default timeouts for the Exit.
- See the
timeoutAction below for details.
The main item Object:
- Each
itemsupports the following Action Names:consider,execute,failsafe,freeze,item,kill,pause,reload,restart,ready,resume,start,stop, andtimeout. - Of those types, the following are considered a
ruleAction:freeze,kill,pause,reload,restart,resume,start,stop, andthaw. -
The
considerItem Action:- A special case of a
ruleAction. - All Action Parameters are the same as with the
ruleAction Parameters. - The difference is that
consideris only processed (instead of being processed and executed) and when someruleAction designates that this consideration is required (vianeed), wanted (viawant), or wished for (viawish) from the within the Rule file. - If this is determined to be executed, then this is immediately executed when needed, wanted or wished for and applies all properties as appropriate (such as
asynchronous, for example). - If this is determined not to be executed, then this
consideris ignored as if it was never there in the first place.
The
executeItem Action:- Execute into the specified program.
- On successful execution, the controller program will no longer be running and will be replaced with the designated program.
- This Item Action is only supported when operating in
programmode.
The
failsafeItem Action:- Accepts only a valid Item Name in which will be executed when a failure is detected.
- Only a single
failsafeItem Action may function at a time. - Each successive
failsafeItem Action specified replaces the previously definedfailsafeItem Action (in a top-down manner). - When operating in
failsafe, therequireItem Action is ignored (given that it is meaningless once operating infailsafemode).
The
failsafeItem Action:- Accepts only a valid Item Name in which will be executed when a failure is detected.
- Only a single
failsafeItem Action may function at a time. - Each successive
failsafeItem Action specified replaces the previously definedfailsafeItem Action (in a top-down manner). - When operating in
failsafe, therequireItem Action is ignored (given that it is meaningless once operating infailsafemode).
The
freezeItem Action:- A
ruleAction for freezing some Control Group. - This Item Action will process the
freezeinner Content of the named Rule. - This is specific to Control Groups and is not yet fully implemented.
- Once implemented this documentation will need to be updated and clarified.
The
itemItem Action:- Accepts only a valid Item Name in which will be immediately executed.
- Any valid Item Name, except for the reserved
main, may be used.
The
killItem Action:- A
ruleAction for forcibly terminating some process. - This Item Action will process the
killinner Content of the named Rule.
The
pauseItem Action:- A
ruleAction for pausing some process. - This Item Action will process the
pauseinner Content of the named Rule.
The
reloadItem Action:- A
ruleAction for pausing some process. - This Item Action will process the
reloadinner Content of the named Rule.
The
restartItem Action:- A
ruleAction for pausing some process. - This Item Action will process the
restartinner Content of the named Rule.
The
resumeItem Action:- A
ruleAction for pausing some process. - This Item Action will process the
resumeinner Content of the named Rule.
The
readyItem Action:- Instructs the controller program when it is safe to perform normal tasks, such as creating the PID file.
- When not specified, the state is always assumed to be ready.
- For example, the controller program may be used as a full blown
initreplacement and therefore may need to mount the/var/run/directory. - If the PID file is created at program start, then the
/var/run/controller.pid would be written before the/var/run/directory is ready. - This could be a problem, such as on a read-only file system the PID creation fails and controller bails out on error.
- Adding
readyessentially specifies a point in time in the Exit in which things are expected to be safe for such basic operations. - When the optional
waitis provided, thenreadywill wait for all currently started asynchronous processes to complete before operating.
The
startItem Action:- A
ruleAction for pausing some process. - This Item Action will process the
startinner Content of the named Rule.
The
stopItem Action:- A
ruleAction for pausing some process. - This Item Action will process the
stopinner Content of the named Rule.
The
thawItem Action:- A
ruleAction for unfreezing some Control Group. - This Item Action will process the
thawinner Content of the named Rule. - This is specific to Control Groups and is not yet fully implemented.
- Once implemented this documentation will need to be updated and clarified.
The
timeoutItem Action:- (This is not currently fully implemented, only
exitis implemented.) - Provides default global settings for each of the four special situations:
exit,kill,start, andstop. - Each of these may only have a single one exist at a time (one
exit, onekill, onestart, and onestop). - Each successive
timeoutItem Action, specific to each Action Name (such asstart), specified replaces the previously definedtimeoutAction (in a top-down manner). - The second Content for each of these, when specified, may be a 0 or greater whole number representing the number of MegaTime (MT) (equivalent to milliseconds).
- For
kill, this represents the number of MegaTime to wait after stopping some Rule and that Rule has not yet stopped to forcefully stop the Rule (aka kill the Rule). - For
start, this represents the number of MegaTime to wait after starting some Rule before assuming something went wrong and the Rule is returned as failed. - For
stop, this represents the number of MegaTime to wait after stopping some Rule before assuming something went wrong and the Rule is returned as failed. - If the second Content is not specified, then this disables the type (prevents the specified timeout action).
- For
exit, this represents the number of MegaTime to wait when the Controller program is exiting (such as having received a terminate signal). - In this case, a terminate signal is sent to all child processes.
- The
exittimeout represents the amount of time to wait after sending the terminate signal before sending a kill signal to each child process still running. - When disabled, the program will not send a kill signal will continue running until all child processes to terminate.
- The
exittimeout does not get applied to any Rule.
- A special case of a