Class: Wheneverd::Trigger::Interval
- Inherits:
-
Object
- Object
- Wheneverd::Trigger::Interval
- Includes:
- Base
- Defined in:
- lib/wheneverd/trigger/interval.rb
Overview
A monotonic interval trigger for systemd timers.
We emit both:
OnActiveSec=to schedule the first run relative to timer activation.OnUnitActiveSec=to schedule subsequent runs relative to the last run.
Instance Attribute Summary collapse
- #seconds ⇒ Integer readonly
Instance Method Summary collapse
-
#initialize(seconds:) ⇒ Interval
constructor
A new instance of Interval.
-
#signature ⇒ String
Stable signature for unit naming.
-
#systemd_timer_lines ⇒ Array<String>
Systemd
[Timer]lines for this trigger.
Constructor Details
#initialize(seconds:) ⇒ Interval
Returns a new instance of Interval.
17 18 19 |
# File 'lib/wheneverd/trigger/interval.rb', line 17 def initialize(seconds:) @seconds = Validation.positive_integer(seconds, name: "Interval seconds") end |
Instance Attribute Details
#seconds ⇒ Integer (readonly)
14 15 16 |
# File 'lib/wheneverd/trigger/interval.rb', line 14 def seconds @seconds end |
Instance Method Details
#signature ⇒ String
Returns stable signature for unit naming.
27 28 29 |
# File 'lib/wheneverd/trigger/interval.rb', line 27 def signature "interval:#{seconds}" end |
#systemd_timer_lines ⇒ Array<String>
Returns systemd [Timer] lines for this trigger.
22 23 24 |
# File 'lib/wheneverd/trigger/interval.rb', line 22 def systemd_timer_lines ["OnActiveSec=#{seconds}", "OnUnitActiveSec=#{seconds}"] end |