Class: Locd::Agent::Job
- Inherits:
-
Locd::Agent
- Object
- Locd::Agent
- Locd::Agent::Job
- Defined in:
- lib/locd/agent/job.rb
Overview
A user-defined agent that runs periodically to perform a task.
Direct Known Subclasses
Defined Under Namespace
Modules: Types
Constant Summary
Constants inherited from Locd::Agent
Instance Attribute Summary
Attributes inherited from Locd::Agent
Creating Servers collapse
-
.create_plist_data(cmd_template:, label:, workdir:, start_interval:, log_path: nil, keep_alive: false, run_at_load: false, **extras) ⇒ Hash<String, Object>
Create the
launchd
property list data for a new Site, which has an additionalport:
keyword versus create_plist_data.
Class Method Summary collapse
Methods inherited from Locd::Agent
#<=>, add, add_or_update, all, class_for, #cmd_template, #config, default_log_path, #default_log_path?, #err_path, exists?, find_all, find_all!, find_only!, from_path, get, #initialize, #label, labels, #last_exit_code, #load, #log_paths, #out_path, #pid, plist_abs_path, plists, #reload, #remove, render_cmd, resolve_log_path, #restart, #running?, #start, #status, #stop, #stopped?, #to_h, #to_json, #to_yaml, #unload, #update, user_plist_abs_dir, #workdir
Constructor Details
This class inherits a constructor from Locd::Agent
Class Method Details
.create_plist_data(cmd_template:, label:, workdir:, start_interval:, log_path: nil, keep_alive: false, run_at_load: false, **extras) ⇒ Hash<String, Object>
Create the launchd
property list data for a new Site, which
has an additional port:
keyword versus Locd::Agent.create_plist_data.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/locd/agent/job.rb', line 97 def self.create_plist_data cmd_template:, label:, workdir:, start_interval:, log_path: nil, keep_alive: false, run_at_load: false, **extras plist_data = super cmd_template: cmd_template, label: label, workdir: workdir, log_path: log_path, keep_alive: keep_alive, run_at_load: run_at_load, **extras start_interval_data = t.match start_interval, t.pos_int, { "StartInterval" => start_interval }, Types.start_calendar_interval, ->( interval ) { { 'StartCalendarInterval' => interval.map { |key, value| [key.to_s.capitalize, value] }.to_h } }, Types.start_calendar_intervals, ->( intervals ) { intervals.map { |interval| interval.map { |key, value| [key.to_s.capitalize, value] }.to_h } } plist_data.merge start_interval_data end |
.plist?(plist) ⇒ return_type
Document plist? method.
Returns @todo Document return value.
54 55 56 57 |
# File 'lib/locd/agent/job.rb', line 54 def self.plist? plist super( plist ) && ( plist.key?( 'StartInterval' ) || plist.key?( 'StartCalendarInterval' ) ) end |