Class: Zold::Routines::Retire
- Inherits:
-
Object
- Object
- Zold::Routines::Retire
- Defined in:
- lib/zold/commands/routines/retire.rb
Overview
Kill the node if it’s too old.
- Author
-
Yegor Bugayenko ([email protected])
- Copyright
-
Copyright © 2018 Yegor Bugayenko
- License
-
MIT
Instance Method Summary collapse
- #exec(step = 0) ⇒ Object
-
#initialize(opts, log: Log::NULL) ⇒ Retire
constructor
A new instance of Retire.
Constructor Details
Instance Method Details
#exec(step = 0) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/zold/commands/routines/retire.rb', line 39 def exec(step = 0) sleep(60) unless @opts['routine-immediately'] days = 4 return if step < days * 24 * 60 && Time.now - @start < days * 24 * 60 * 60 return if @opts['never-reboot'] @log.info("We are too old, step ##{step}, it's time to retire (use --never-reboot to avoid this)") require_relative '../../node/front' Zold::Front.stop! end |