The Entry and Exit files are using "rule" to designate a Rule to operate.
This is designed on the assumption that an Entry always runs a "start" and Exit always runs a "stop".
This behavior is changed such that "rule" is no longer specified and one of the 9 supported Actions may be used.
Such as "start" or "stop", for example.
There is still more work to do as this change doesn't fix the Exit in terms of dependency handling.
Currently, the process structure does not distinguish the Rule action, such as "start" or "stop".
Additional changes to the process structure are needed.
#endif // _di_controller_processs_t_
/**
- * An Entry Item Action
+ * An Entry Item Action.
+ *
+ * controller_entry_action_type_*:
+ * - consider: Designate a rule to be pre-loaded.
+ * - failsafe: Designate a failsafe "item".
+ * - freeze: A Rule Action for freezing.
+ * - item: A named set of Rules.
+ * - kill: A Rule Action for killing.
+ * - pause: A Rule Action for pausing.
+ * - ready: Designate readiness for special processing for Entry or Exit.
+ * - reload: A Rule Action for reloading.
+ * - restart: A Rule Action for restarting.
+ * - resume: A Rule Action for resuming.
+ * - start: A Rule Action for starting.
+ * - stop: A Rule Action for stopping.
+ * - timeout: Inline timeout settings.
+ * - thaw: A Rule Action for unfreezing.
+ *
+ * controller_entry_rule_code_*:
+ * - asynchronous: Process Rule asynchronously.
+ * - require: Require Rule operations to succeed or the Entry/Exit will fail.
+ * - wait: Wait for all existing asynchronous processes to finish before operating Rule.
+ *
+ * controller_entry_timeout_code_*:
+ * - kill: Designate time to wait before killing.
+ * - start: Designate time to wait before starting.
+ * - stop: Designate time to wait before stopping.
*
* type: The type of Action.
* code: A single code or sub-type associated with the Action.
enum {
controller_entry_action_type_consider = 1,
controller_entry_action_type_failsafe,
+ controller_entry_action_type_freeze,
controller_entry_action_type_item,
+ controller_entry_action_type_kill,
+ controller_entry_action_type_pause,
controller_entry_action_type_ready,
- controller_entry_action_type_rule,
+ controller_entry_action_type_reload,
+ controller_entry_action_type_restart,
+ controller_entry_action_type_resume,
+ controller_entry_action_type_start,
+ controller_entry_action_type_stop,
controller_entry_action_type_timeout,
+ controller_entry_action_type_thaw,
};
#define controller_entry_rule_code_asynchronous 0x1
#endif // _di_controller_preprocess_entry_
#ifndef _di_controller_process_entry_
- f_status_t controller_process_entry(const bool failsafe, const bool is_entry, const uint8_t action, controller_main_t *main, controller_cache_t *cache) {
+ f_status_t controller_process_entry(const bool failsafe, const bool is_entry, controller_main_t *main, controller_cache_t *cache) {
f_status_t status = F_none;
f_status_t status_lock = F_none;
}
if (F_status_is_error(entry_action->status)) {
- if (entry_action->type == controller_entry_action_type_rule) {
+ if (controller_entry_action_type_is_rule(entry_action->type)) {
if (simulate) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
// exit inner loop to force restarting and start processing the requested item.
break;
}
- else if (entry_action->type == controller_entry_action_type_consider || entry_action->type == controller_entry_action_type_rule) {
+ else if (entry_action->type == controller_entry_action_type_consider || controller_entry_action_type_is_rule(entry_action->type)) {
status_lock = controller_lock_write(is_entry, main->thread, &main->thread->lock.rule);
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->output.stream, "%s entry item rule '", entry_action->type == controller_entry_action_type_rule ? "Processing" : "Considering");
+ fprintf(main->data->output.stream, "%s entry item rule '", entry_action->type == controller_entry_action_type_consider ? "Considering" : "Processing");
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, alias_rule.string, main->data->context.set.title.after->string);
fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]);
}
}
- status = controller_rule_process_begin(options_force, alias_rule, is_entry ? controller_rule_action_type_start : controller_rule_action_type_stop, options_process, is_entry ? controller_process_type_entry : controller_process_type_exit, stack, *main, *cache);
+ status = controller_rule_process_begin(options_force, alias_rule, controller_entry_action_type_to_rule_action_type(entry_action->type), options_process, is_entry ? controller_process_type_entry : controller_process_type_exit, stack, *main, *cache);
if (F_status_set_fine(status) == F_memory_not || status == F_child || status == F_signal || !controller_thread_is_enabled(is_entry, main->thread)) {
break;
* @param is_entry
* If TRUE, then this operate as an entry.
* If FALSE, then this operate as an exit.
- * @param action
- * The action to perform, should be either controller_rule_action_type_start (for entry) or controller_rule_action_type_stop (for exit).
* @param main
* The main data.
* @param cache
* @see controller_string_dynamic_append_terminated()
*/
#ifndef _di_controller_process_entry_
- extern f_status_t controller_process_entry(const bool failsafe, const bool is_entry, const uint8_t action, controller_main_t *main, controller_cache_t *cache) f_gcc_attribute_visibility_internal;
+ extern f_status_t controller_process_entry(const bool failsafe, const bool is_entry, controller_main_t *main, controller_cache_t *cache) f_gcc_attribute_visibility_internal;
#endif // _di_controller_process_entry_
/**
}
#endif // _di_controller_entry_action_parameters_print_
+#ifndef _di_controller_entry_action_type_is_rule_
+ f_status_t controller_entry_action_type_is_rule(uint8_t type) {
+
+ switch (type) {
+ case controller_entry_action_type_freeze:
+ case controller_entry_action_type_kill:
+ case controller_entry_action_type_pause:
+ case controller_entry_action_type_reload:
+ case controller_entry_action_type_restart:
+ case controller_entry_action_type_resume:
+ case controller_entry_action_type_start:
+ case controller_entry_action_type_stop:
+ case controller_entry_action_type_thaw:
+ return F_true;
+ }
+
+ return F_false;
+ }
+#endif // _di_controller_entry_action_type_is_rule_
+
#ifndef _di_controller_entry_action_type_name_
f_string_static_t controller_entry_action_type_name(const uint8_t type) {
buffer.used = controller_string_failsafe_length;
break;
+ case controller_entry_action_type_freeze:
+ buffer.string = controller_string_freeze_s;
+ buffer.used = controller_string_freeze_length;
+ break;
+
case controller_entry_action_type_item:
buffer.string = controller_string_item_s;
buffer.used = controller_string_item_length;
break;
+ case controller_entry_action_type_kill:
+ buffer.string = controller_string_kill_s;
+ buffer.used = controller_string_kill_length;
+ break;
+
+ case controller_entry_action_type_pause:
+ buffer.string = controller_string_pause_s;
+ buffer.used = controller_string_pause_length;
+ break;
+
case controller_entry_action_type_ready:
buffer.string = controller_string_ready_s;
buffer.used = controller_string_ready_length;
break;
- case controller_entry_action_type_rule:
- buffer.string = controller_string_rule_s;
- buffer.used = controller_string_rule_length;
+ case controller_entry_action_type_reload:
+ buffer.string = controller_string_reload_s;
+ buffer.used = controller_string_reload_length;
+ break;
+
+ case controller_entry_action_type_restart:
+ buffer.string = controller_string_restart_s;
+ buffer.used = controller_string_restart_length;
+ break;
+
+ case controller_entry_action_type_resume:
+ buffer.string = controller_string_resume_s;
+ buffer.used = controller_string_resume_length;
+ break;
+
+ case controller_entry_action_type_start:
+ buffer.string = controller_string_start_s;
+ buffer.used = controller_string_start_length;
+ break;
+
+ case controller_entry_action_type_stop:
+ buffer.string = controller_string_stop_s;
+ buffer.used = controller_string_stop_length;
+ break;
+
+ case controller_entry_action_type_thaw:
+ buffer.string = controller_string_thaw_s;
+ buffer.used = controller_string_thaw_length;
break;
case controller_entry_action_type_timeout:
}
#endif // _di_controller_entry_action_type_name_
+#ifndef _di_controller_entry_action_type_to_rule_action_type_
+ uint8_t controller_entry_action_type_to_rule_action_type(uint8_t type) {
+
+ switch (type) {
+ case controller_entry_action_type_freeze:
+ return controller_rule_action_type_freeze;
+
+ case controller_entry_action_type_kill:
+ return controller_rule_action_type_kill;
+
+ case controller_entry_action_type_pause:
+ return controller_rule_action_type_pause;
+
+ case controller_entry_action_type_reload:
+ return controller_rule_action_type_reload;
+
+ case controller_entry_action_type_restart:
+ return controller_rule_action_type_restart;
+
+ case controller_entry_action_type_resume:
+ return controller_rule_action_type_resume;
+
+ case controller_entry_action_type_start:
+ return controller_rule_action_type_start;
+
+ case controller_entry_action_type_stop:
+ return controller_rule_action_type_stop;
+
+ case controller_entry_action_type_thaw:
+ return controller_rule_action_type_thaw;
+ }
+
+ return 0;
+ }
+#endif // _di_controller_entry_action_type_to_rule_action_type_
+
#ifndef _di_controller_entry_actions_increase_by_
f_status_t controller_entry_actions_increase_by(const f_array_length_t amount, controller_entry_actions_t *actions) {
else if (fl_string_dynamic_compare_string(controller_string_failsafe_s, cache->action.name_action, controller_string_failsafe_length) == F_equal_to) {
actions->array[actions->used].type = controller_entry_action_type_failsafe;
}
+ else if (fl_string_dynamic_compare_string(controller_string_freeze_s, cache->action.name_action, controller_string_freeze_length) == F_equal_to) {
+ actions->array[actions->used].type = controller_entry_action_type_freeze;
+ }
else if (fl_string_dynamic_compare_string(controller_string_item_s, cache->action.name_action, controller_string_item_length) == F_equal_to) {
actions->array[actions->used].type = controller_entry_action_type_item;
}
+ else if (fl_string_dynamic_compare_string(controller_string_kill_s, cache->action.name_action, controller_string_kill_length) == F_equal_to) {
+ actions->array[actions->used].type = controller_entry_action_type_kill;
+ }
+ else if (fl_string_dynamic_compare_string(controller_string_pause_s, cache->action.name_action, controller_string_pause_length) == F_equal_to) {
+ actions->array[actions->used].type = controller_entry_action_type_pause;
+ }
else if (fl_string_dynamic_compare_string(controller_string_ready_s, cache->action.name_action, controller_string_ready_length) == F_equal_to) {
actions->array[actions->used].type = controller_entry_action_type_ready;
}
- else if (fl_string_dynamic_compare_string(controller_string_rule_s, cache->action.name_action, controller_string_rule_length) == F_equal_to) {
- actions->array[actions->used].type = controller_entry_action_type_rule;
+ else if (fl_string_dynamic_compare_string(controller_string_reload_s, cache->action.name_action, controller_string_reload_length) == F_equal_to) {
+ actions->array[actions->used].type = controller_entry_action_type_reload;
+ }
+ else if (fl_string_dynamic_compare_string(controller_string_restart_s, cache->action.name_action, controller_string_restart_length) == F_equal_to) {
+ actions->array[actions->used].type = controller_entry_action_type_restart;
+ }
+ else if (fl_string_dynamic_compare_string(controller_string_resume_s, cache->action.name_action, controller_string_resume_length) == F_equal_to) {
+ actions->array[actions->used].type = controller_entry_action_type_resume;
+ }
+ else if (fl_string_dynamic_compare_string(controller_string_start_s, cache->action.name_action, controller_string_start_length) == F_equal_to) {
+ actions->array[actions->used].type = controller_entry_action_type_start;
+ }
+ else if (fl_string_dynamic_compare_string(controller_string_stop_s, cache->action.name_action, controller_string_stop_length) == F_equal_to) {
+ actions->array[actions->used].type = controller_entry_action_type_stop;
+ }
+ else if (fl_string_dynamic_compare_string(controller_string_thaw_s, cache->action.name_action, controller_string_thaw_length) == F_equal_to) {
+ actions->array[actions->used].type = controller_entry_action_type_thaw;
}
else if (fl_string_dynamic_compare_string(controller_string_timeout_s, cache->action.name_action, controller_string_timeout_length) == F_equal_to) {
actions->array[actions->used].type = controller_entry_action_type_timeout;
continue;
}
- if (action->type == controller_entry_action_type_consider || action->type == controller_entry_action_type_rule) {
+ if (action->type == controller_entry_action_type_consider || controller_entry_action_type_is_rule(action->type)) {
allocate = cache->content_actions.array[i].used;
at_least = 2;
at_most = allocate;
fprintf(main.data->error.to.stream, "%s%s%llu%s", main.data->error.context.after->string, main.data->error.notable.before->string, at_least, main.data->error.notable.after->string);
- if (action->type == controller_entry_action_type_consider || action->type == controller_entry_action_type_rule) {
+ if (action->type == controller_entry_action_type_consider || controller_entry_action_type_is_rule(action->type)) {
fprintf(main.data->error.to.stream, "%s or more parameters.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
}
else {
} // for
if (F_status_is_error_not(action->status)) {
- if (action->type == controller_entry_action_type_consider || action->type == controller_entry_action_type_rule) {
+ if (action->type == controller_entry_action_type_consider || controller_entry_action_type_is_rule(action->type)) {
if (action->parameters.array[0].used) {
// force the path to be canonical (removing all '../' parts).
#endif // _di_controller_entry_action_parameters_print_
/**
+ * Determine if the type code represents a Rule type.
+ *
+ * @param type
+ * The type code to compare against.
+ *
+ * @return
+ * TRUE if Rule type.
+ * FALSE otherwise.
+ */
+#ifndef _di_controller_entry_action_type_is_rule_
+ extern f_status_t controller_entry_action_type_is_rule(uint8_t type) f_gcc_attribute_visibility_internal;
+#endif // _di_controller_entry_action_type_is_rule_
+
+/**
* Get a string representing the entry action type.
*
* @param type
#endif // _di_controller_entry_action_type_name_
/**
+ * Convert the Entry Action type to Rule Action type.
+ *
+ * @param type
+ * The Entry Action type.
+ *
+ * @return
+ * TRUE if Rule type.
+ * FALSE otherwise.
+ */
+#ifndef _di_controller_entry_action_type_to_rule_action_type_
+ extern uint8_t controller_entry_action_type_to_rule_action_type(uint8_t type) f_gcc_attribute_visibility_internal;
+#endif // _di_controller_entry_action_type_to_rule_action_type_
+
+/**
* Increase the size of the entry item actions array by the specified amount, but only if necessary.
*
* This only increases size if the current used plus amount is greater than the currently allocated size.
break;
default:
-
if (main.data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main.thread->lock.print);
// i==0 is need, i==1 is want, i==2 is wish.
// loop through all dependencies: wait for depedency, execute dependency, fail due to missing required dependency, or skip unrequired missing dependencies.
- for (i = 0; i < 3 && controller_thread_is_enabled_process(process, main.thread); ++i) {
+ for (; i < 3 && controller_thread_is_enabled_process(process, main.thread); ++i) {
for (j = 0; j < dynamics[i]->used && controller_thread_is_enabled_process(process, main.thread); ++j) {
f_thread_unlock(&process->lock);
if (F_status_is_error_not(status)) {
- if (options_force & controller_process_option_asynchronous) {
+ if (process->action && (options_force & controller_process_option_asynchronous)) {
status = f_thread_create(0, &process->id_thread, controller_thread_process, (void *) process);
if (F_status_is_error(status)) {
}
}
+ if (!action || F_status_is_error(status) && (process->state == controller_process_state_active || process->state == controller_process_state_busy)) {
+ status = controller_lock_write_process(process, main.thread, &process->lock);
+
+ if (status == F_signal || F_status_is_error(status)) {
+ controller_lock_error_critical_print(main.data->error, F_status_set_fine(status), F_false, main.thread);
+
+ f_thread_unlock(&process->active);
+
+ return status;
+ }
+
+ if (!action || (options_force & controller_process_option_asynchronous)) {
+ process->state = controller_process_state_done;
+ }
+ else {
+ process->state = controller_process_state_idle;
+ }
+
+ f_thread_unlock(&process->lock);
+ }
+
f_thread_unlock(&process->active);
if (F_status_is_error(status)) {
if (F_status_is_error(status)) {
controller_entry_error_print(main.data->error, process->cache.action, F_status_set_fine(status), "controller_rule_copy", F_true, main.thread);
}
+ else if (!process->action) {
+
+ // this is a "consider" Action, so do not actually execute the rule.
+ f_thread_unlock(&process->lock);
+
+ if (options_force & controller_process_option_asynchronous) {
+ f_thread_unlock(&process->active);
+ }
+
+ return F_process_not;
+ }
else {
for (f_array_length_t i = 0; i < process->stack.used && controller_thread_is_enabled_process(process, main.thread); ++i) {
f_thread_mutex_lock(&main.thread->lock.print);
switch (action) {
+ case controller_rule_action_type_freeze:
case controller_rule_action_type_kill:
+ case controller_rule_action_type_pause:
case controller_rule_action_type_reload:
case controller_rule_action_type_restart:
+ case controller_rule_action_type_resume:
case controller_rule_action_type_start:
case controller_rule_action_type_stop:
+ case controller_rule_action_type_thaw:
break;
default:
for (j = 0; j < rule.items.array[i].actions.used; ++j) {
- if (rule.items.array[i].actions.array[j].type == action) {
+ if (!action || rule.items.array[i].actions.array[j].type == action) {
missing = F_false;
break;
}
*
* @return
* F_none on success.
- * F_found on success and the process was found to already be running (nothing to do).
+ * F_found on the process was found to already be running (nothing to do).
+ * F_process_not if the process was not executed because it is a "consider" Action.
* F_signal on (exit) signal received.
*
* F_found_not (with error bit) if unable to for a process for the given rule id.
* The rule to process.
* @param action
* The action to perform based on the action type codes.
- *
- * Only subset of the action type codes are supported:
- * - controller_rule_action_type_kill
- * - controller_rule_action_type_reload
- * - controller_rule_action_type_restart
- * - controller_rule_action_type_start
- * - controller_rule_action_type_stop
* @param options
* A number using bits to represent specific boolean options.
* If no bits set, then operate normally in a synchronous manner.
*status = F_status_set_error(F_available_not);
}
else {
- *status = controller_process_entry(F_false, F_true, controller_rule_action_type_start, entry->main, cache);
+ *status = controller_process_entry(F_false, F_true, entry->main, cache);
if (F_status_is_error(*status)) {
entry->setting->ready = controller_setting_ready_fail;
if (F_status_set_fine(*status) == F_require && entry->main->setting->failsafe_enabled) {
- const f_status_t status_failsafe = controller_process_entry(F_true, F_true, controller_rule_action_type_start, entry->main, cache);
+ const f_status_t status_failsafe = controller_process_entry(F_true, F_true, entry->main, cache);
if (F_status_is_error(status_failsafe)) {
if (data->error.verbosity != f_console_verbosity_quiet) {
if (F_status_is_error_not(*status) && *status != F_signal && *status != F_child && *status != F_file_found_not) {
if (data->parameters[controller_parameter_validate].result == f_console_result_none || data->parameters[controller_parameter_test].result == f_console_result_found) {
- *status = controller_process_entry(F_false, F_false, controller_rule_action_type_stop, entry->main, cache);
+ *status = controller_process_entry(F_false, F_false, entry->main, cache);
if (F_status_is_error(*status)) {
entry->setting->ready = controller_setting_ready_fail;
item console
boot:
- rule boot filesystem require
- rule boot modules require
- rule boot devices require
+ start boot filesystem require
+ start boot modules require
+ start boot devices require
- rule service logger wait
- rule service dbus asynchronous
+ start service logger wait
+ start service dbus asynchronous
ready
net:
- rule net all asynchronous
+ start net all asynchronous
time:
- rule task clock asynchronous
+ start task clock asynchronous
keyboard:
- rule task keyboard asynchronous
+ start task keyboard asynchronous
console:
- rule program terminal require wait
- rule service mouse
+ start program terminal require wait
+ start service mouse
maintenance:
timeout start 2
timeout stop 2
timeout kill 2
- rule maintenance console
+ start maintenance console
# fss-0005
main:
- rule serial s_1 asynchronous
- rule serial s_2 asynchronous
- rule serial s_3 asynchronous
- rule serial s_4 asynchronous
- rule serial s_5 asynchronous
- rule serial s_6 asynchronous
+ start serial s_1 asynchronous
+ start serial s_2 asynchronous
+ start serial s_3 asynchronous
+ start serial s_4 asynchronous
+ start serial s_5 asynchronous
+ start serial s_6 asynchronous
ready wait
# fss-0005
setting:
- mode program
+ mode program
main:
ready
consider asynchronous sleep_8 asynchronous
consider asynchronous sleep_10 asynchronous
- rule asynchronous sleep_1 asynchronous
- rule asynchronous sleep_2 asynchronous
- rule asynchronous sleep_3 asynchronous
- rule asynchronous sleep_5 asynchronous
- rule asynchronous sleep_8 asynchronous
- rule asynchronous sleep_10 asynchronous
+ start asynchronous sleep_1 asynchronous
+ start asynchronous sleep_2 asynchronous
+ start asynchronous sleep_3 asynchronous
+ start asynchronous sleep_5 asynchronous
+ start asynchronous sleep_8 asynchronous
+ start asynchronous sleep_10 asynchronous
mode program
main:
- rule serial s_1
- rule serial s_2
- rule serial s_3
- rule serial s_4
- rule serial s_5
- rule serial s_6
+ start serial s_1
+ start serial s_2
+ start serial s_3
+ start serial s_4
+ start serial s_5
+ start serial s_6
ready
consider serial s_4
consider serial s_5
- rule serial s_6
+ start serial s_6
ready
timeout stop 7
timeout kill 3
- failsafe boom
+ failsafe explode
- rule service sshd
+ start service sshd
-boom:
- rule maintenance explode
+explode:
+ start maintenance boom
timeout stop 7
timeout kill 3
- failsafe boom
+ failsafe explode
item first
item last
first:
consider script require_me
- rule script succeed
- rule script php
- rule command multiple
+ start script succeed
+ start script php
+ start command multiple
# uncomment python to see it fail.
- #rule script python
+ #start script python
last:
- rule script fail require wait
+ start script fail require wait
-boom:
- rule maintenance explode
+explode:
+ start maintenance boom
timeout stop 7
timeout kill 3
- failsafe boom
+ failsafe explode
- rule utility sleeper_1
- rule utility sleeper_2
+ start utility sleeper_1
+ start utility sleeper_2
-boom:
- rule maintenance explode
+explode:
+ start maintenance boom
consider serial s_4
consider serial s_5
- rule serial s_6
+ stop serial s_6
ready
failsafe boom
- rule service sshd
+ stop service sshd
boom:
- rule maintenance explode
+ stop maintenance explode
pid_file /var/run/sshd.pid
with full_path
start sshd
- #stop
The "service" mode (the default mode) designates that the Entry operates as a service and will sit and wait for control commands when complete.
The "service" mode will call the "exit" with the same name as this Entry, but with the extension "exit", such as "default.exit".
- Each item supports the following Action Names: "consider", "failsafe", "item", "ready", "rule", and "timeout".
+ Each item supports the following Action Names: "consider", "failsafe", "freeze", "item", "kill", "pause", "reload", "restart", "ready", "resume", "start", "stop", and "timeout".
+ Of those types, the following are considered a "rule" Action: "freeze", "kill", "pause", "reload", "restart", "resume", "start", and "stop".
The "consider" Action is a special case of a "rule" Action.
All Action Parameters are the same as with the "rule" Action Parameters.
Each successive "failsafe" Action specified replaces the previously defined "failsafe" Action (in a top-down manner).
When operating in "failsafe", the "require" Action is ignored given that it is meaningless once operating in failsafe.
+ The "freeze" is a "rule" Action for freezing some Control Group.
+ This "rule" Action will process the "freeze" inner 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 "item" 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 "kill" is a "rule" Action for forcibly terminating some process.
+ This "rule" Action will process the "kill" inner Content of the named Rule.
+
+ The "pause" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "pause" inner Content of the named Rule.
+
+ The "reload" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "reload" inner Content of the named Rule.
+
+ The "restart" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "restart" inner Content of the named Rule.
+
+ The "resume" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "resume" inner Content of the named Rule.
+
The "ready" 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 "init" replacement and therefore may need to mount the /var/run/ directory.
Adding "ready" essentially specifies a point in time in the Entry in which things are expected to be safe for such basic operations.
When the optional "wait" is provided, then "ready" will wait for all currently started asynchronous processes to complete before operating.
- The "rule" Action immediately executes a named rule file.
+ The "start" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "start" inner Content of the named Rule.
+
+ The "stop" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "stop" inner Content of the named Rule.
+
+ The "thaw" is a "rule" Action for unfreezing some Control Group.
+ This "rule" Action will process the "thaw" inner 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 "timeout" Action provides default global settings for each of the three special situations: "start", "stop", and "kill".
+ Each of these may only have a single one exist at a time (one "start", one "stop", and one "kill").
+ Each successive "timeout" Action, specific to each Action Name (such as "start"), specified replaces the previously defined "timeout" Action (in a top-down manner).
+ Each of these accepts a single Action Parameter that is a 0 or greater whole number representing the number of MegaTime (MT) (equivalent to milliseconds).
+ 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.
+ 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).
+ The timeouts are generally only valid for services such as daemon services.
+ A value of 0 disables this (prevents any action).
+
+Entry Rule Documentation:
+ There are multiple Entry Actions that are considered "rule" Actions.
+ These are: "freeze", "kill", "pause", "reload", "restart", "resume", "start", and "stop".
+
+ The "rule" Actions immediately execute a named rule file.
The first Action Parameter represents the rule directory, which is a relative directory path the rule file is to be found.
- Do not include leading or trailing slashes.
- This is relative to the settings rules directory.
It is important to note that for any given "rule", execution within that "rule" may be internally asynchronous (even if the "rule" is synchronous).
For example, a service that is often called a daemon will execute in the background.
Until that execution succeeds and the daemon goes into the background the representing rule will block.
- After the daemon goes into the background, then the representing rule will be fully executed.
-
- Any "rule" specified in this Entry file is always executed using the "start" rule action type.
-
- The "timeout" Action provides default global settings for each of the three special situations: "start", "stop", and "kill".
- Each of these may only have a single one exist at a time (one "start", one "stop", and one "kill").
- Each successive "timeout" Action, specific to each Action Name (such as "start"), specified replaces the previously defined "timeout" Action (in a top-down manner).
- Each of these accepts a single Action Parameter that is a 0 or greater whole number representing the number of MegaTime (MT) (equivalent to milliseconds).
- 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.
- 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).
- The timeouts are generally only valid for services such as daemon services.
- A value of 0 disables this (prevents any action).
+ After the daemon goes into the background, then the representing rule will no longer block and be fully executed.
A number of settings are supported, but if this Item Object is not specified, then defaults are used.
There are no settings are available.
- Each item supports the following Action Names: "consider", "failsafe", "item", "ready", "rule", and "timeout".
+ Each item supports the following Action Names: "consider", "failsafe", "freeze", "item", "kill", "pause", "reload", "restart", "ready", "resume", "start", "stop", and "timeout".
+ Of those types, the following are considered a "rule" Action: "freeze", "kill", "pause", "reload", "restart", "resume", "start", and "stop".
The "consider" Action is a special case of a "rule" Action.
All Action Parameters are the same as with the "rule" Action Parameters.
Each successive "failsafe" Action specified replaces the previously defined "failsafe" Action (in a top-down manner).
When operating in "failsafe", the "require" Action is ignored given that it is meaningless once operating in failsafe.
+ The "freeze" is a "rule" Action for freezing some Control Group.
+ This "rule" Action will process the "freeze" inner 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 "item" 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 "ready" Action instructs the controller program when it is safe to perform stop tasks.
- A stop task is simply informing all controlled processes to stop.
- When not specified, the state is always assumed to be ready (all controlled processes are immediately informed to stop).
+ The "kill" is a "rule" Action for forcibly terminating some process.
+ This "rule" Action will process the "kill" inner Content of the named Rule.
+
+ The "pause" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "pause" inner Content of the named Rule.
+
+ The "reload" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "reload" inner Content of the named Rule.
+
+ The "restart" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "restart" inner Content of the named Rule.
+
+ The "resume" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "resume" inner Content of the named Rule.
+
+ The "ready" 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 "init" replacement 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 filesystem the pid creation fails and controller bails out on error.
+ Adding "ready" essentially specifies a point in time in the Entry in which things are expected to be safe for such basic operations.
+ When the optional "wait" is provided, then "ready" will wait for all currently started asynchronous processes to complete before operating.
+
+ The "start" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "start" inner Content of the named Rule.
+
+ The "stop" is a "rule" Action for pausing some process.
+ This "rule" Action will process the "stop" inner Content of the named Rule.
- The "rule" Action immediately executes a named rule file.
+ The "thaw" is a "rule" Action for unfreezing some Control Group.
+ This "rule" Action will process the "thaw" inner 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 "timeout" Action provides default global settings for each of the three special situations: "start", "stop", and "kill".
+ Each of these may only have a single one exist at a time (one "start", one "stop", and one "kill").
+ Each successive "timeout" Action, specific to each Action Name (such as "start"), specified replaces the previously defined "timeout" Action (in a top-down manner).
+ Each of these accepts a single Action Parameter that is a 0 or greater whole number representing the number of MegaTime (MT) (equivalent to milliseconds).
+ 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.
+ 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).
+ The timeouts are generally only valid for services such as daemon services.
+ A value of 0 disables this (prevents any action).
+
+Entry Rule Documentation:
+ There are multiple Entry Actions that are considered "rule" Actions.
+ These are: "freeze", "kill", "pause", "reload", "restart", "resume", "start", and "stop".
+
+ The "rule" Actions immediately execute a named rule file.
The first Action Parameter represents the rule directory, which is a relative directory path the rule file is to be found.
- Do not include leading or trailing slashes.
- This is relative to the settings rules directory.
It is important to note that for any given "rule", execution within that "rule" may be internally asynchronous (even if the "rule" is synchronous).
For example, a service that is often called a daemon will execute in the background.
Until that execution succeeds and the daemon goes into the background the representing rule will block.
- After the daemon goes into the background, then the representing rule will be fully executed.
-
- Any "rule" specified in this Exit file is always executed using the "stop" rule action type.
-
- The "timeout" Action provides default global settings for each of the three special situations: "start", "stop", and "kill".
- Each of these may only have a single one exist at a time (one "start", one "stop", and one "kill").
- Each successive "timeout" Action, specific to each Action Name (such as "start"), specified replaces the previously defined "timeout" Action (in a top-down manner).
- Each of these accepts a single Action Parameter that is a 0 or greater whole number representing the number of MegaTime (MT) (equivalent to milliseconds).
- 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.
- 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).
- The timeouts are generally only valid for services such as daemon services.
- A value of 0 disables this (prevents any action).
+ After the daemon goes into the background, then the representing rule will no longer block and be fully executed.
The "utility" Rule Type provides a "script" accompanied with a PID file (Process Identifier file).
- There are seven primary inner Content to perform: "kill", "pause", "restart", "resume", "reload", "start", and "stop".
-
- The "kill" Content is performed whenever this rule is executed using the kill action (which is, in general, a forced stop).
- The "pause" Content is performed whenever this rule is executed using the pause action.
- The "restart" Content is performed whenever this rule is executed using the restart action.
- The "resume" Content is performed whenever this rule is executed using the resume action.
- The "reload" Content is performed whenever this rule is executed using the reload action.
- The "start" Content is performed whenever this rule is executed using the start action.
- The "stop" Content is performed whenever this rule is executed using the stop action.
-
- When "restart" Content is not provided, then "start" and "stop" is called when the rule is executed using the restart action, if both "start" and "stop" are provided.
- When "reload", "start", or "stop" Content are not provided, then no respective action is performed.
+ There are nine primary inner Content Objects to perform: "freeze", "kill", "pause", "restart", "resume", "reload", "start", "stop", "thaw".
+
+ The "freeze" Object's Content is performed whenever this rule is executed using the freeze Action.
+ The "kill" Object's Content is performed whenever this rule is executed using the kill Action (which is, in general, a forced stop).
+ The "pause" Object's Content is performed whenever this rule is executed using the pause Action.
+ The "restart" Object's Content is performed whenever this rule is executed using the restart Action.
+ The "resume" Object's Content is performed whenever this rule is executed using the resume Action.
+ The "reload" Object's Content is performed whenever this rule is executed using the reload Action.
+ The "start" Object's Content is performed whenever this rule is executed using the start Action.
+ The "stop" Object's Content is performed whenever this rule is executed using the stop Action.
+ The "thaw" Object's Content is performed whenever this rule is executed using the thaw Action.
+
+ When "restart" Object's Content is not provided, then "start" and "stop" is called when the rule is executed using the restart Action, if both "start" and "stop" are provided.
+ When "reload", "start", or "stop" Object's Content are not provided, then no respective Action is performed.
Commands are conditionally available depending on the presence of these, such as if "stop" is not provided then "stop" (and "restart") will not be available for the "control" program(s) to use.
- The "pid_file" Content designates the path to the PID file created by the called program.
+ The "pid_file" Object's Content designates the path to the PID file created by the called program.
- The "with" Content designates special flags designating very specific behavior to be applied to any single Rule Type.
+ The "with" Object's Content designates special flags designating very specific behavior to be applied to any single Rule Type.
The following flags are supported:
"full_path": Used only by Rule Types that execute something, wherein the entire full path is used for execution and is assigned as argument[0] (such as "/bin/bash").
When not specified, the path provided is used and the argument[0] will be the base name (such as "bash").
- "require"
- "wait"
"failsafe": One Content that is a valid Object name, except for the reserved "main".
+ "freeze": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
"item": One Content that is a valid Object name, except for the reserved "main".
+ "kill": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "pause": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
"ready": Zero or One Content.
The first may only be one of\:
- "wait"
- "rule": Two or more Content.
+ "reload": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "restart": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "resume": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "start": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "stop": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "thaw": Two or more Content.
The first Content that is the relative directory path (without any leading/trailing slashes).
The second Content that is the basename for a rule file.
The third and beyond may only be one of\:
- "require"
- "wait"
"failsafe": One Content that is a valid Object name, except for the reserved "main".
+ "freeze": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
"item": One Content that is a valid Object name, except for the reserved "main".
+ "kill": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "pause": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
"ready": Zero or One Content.
The first may only be one of\:
- "wait"
- "rule": Two or more Content.
+ "reload": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "restart": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "resume": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "start": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "stop": Two or more Content.
+ The first Content that is the relative directory path (without any leading/trailing slashes).
+ The second Content that is the basename for a rule file.
+ The third and beyond may only be one of\:
+ - "asynchronous"
+ - "require"
+ - "wait"
+ "thaw": Two or more Content.
The first Content that is the relative directory path (without any leading/trailing slashes).
The second Content that is the basename for a rule file.
The third and beyond may only be one of\:
"wish": Two Content, the first being a partial path and the second being a rule file name without extension (such as "boot" "modules").
The "command" and "script" Rule Types allow the following the FSS-0001 (Extended)\:
+ "freeze": One or more Content representing a program being executed and its arguments.
"kill": One or more Content representing a program being executed and its arguments.
"pause": One or more Content representing a program being executed and its arguments.
"reload": One or more Content representing a program being executed and its arguments.
"resume": One or more Content representing a program being executed and its arguments.
"start": One or more Content representing a program being executed and its arguments.
"stop": One or more Content representing a program being executed and its arguments.
+ "thaw": One or more Content representing a program being executed and its arguments.
"with": One or more Content representing special options for the Rule Type.
The "service" and "utility" Rule Types allow the following the FSS-0001 (Extended)\:
"with": One or more Content representing special options for the Rule Type.
The "command" and "service" Rule Types allow the following the FSS-0003 (Extended List)\:
+ "freeze": A list repesenting multiple programs and their respective arguments to execute.
"kill": A list repesenting multiple programs and their respective arguments to execute.
"pause": A list repesenting multiple programs and their respective arguments to execute.
"reload": A list repesenting multiple programs and their respective arguments to execute.
"resume": A list repesenting multiple programs and their respective arguments to execute.
"start": A list repesenting multiple programs and their respective arguments to execute.
"stop": A list repesenting multiple programs and their respective arguments to execute.
+ "thaw": A list repesenting multiple programs and their respective arguments to execute.
The "script" and "utility" Rule Types allow the following the FSS-0003 (Extended List)\:
+ "freeze": A list repesenting the contents of a script, such as a GNU Bash shell.
"kill": A list repesenting the contents of a script, such as a GNU Bash shell.
"pause": A list repesenting the contents of a script, such as a GNU Bash shell.
"reload": A list repesenting the contents of a script, such as a GNU Bash shell.
"resume": A list repesenting the contents of a script, such as a GNU Bash shell.
"start": A list repesenting the contents of a script, such as a GNU Bash shell.
"stop": A list repesenting the contents of a script, such as a GNU Bash shell.
+ "thaw": A list repesenting the contents of a script, such as a GNU Bash shell.