Class: Legion::CLI::Doctor::PidCheck
- Inherits:
-
Object
- Object
- Legion::CLI::Doctor::PidCheck
- Defined in:
- lib/legion/cli/doctor/pid_check.rb
Constant Summary collapse
- PID_PATHS =
['/var/run/legion.pid', '/tmp/legion.pid'].freeze
Instance Method Summary collapse
Instance Method Details
#fix ⇒ Object
29 30 31 |
# File 'lib/legion/cli/doctor/pid_check.rb', line 29 def fix stale_pid_files.each { |f| File.delete(f) } end |
#name ⇒ Object
9 10 11 |
# File 'lib/legion/cli/doctor/pid_check.rb', line 9 def name 'PID files' end |
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/legion/cli/doctor/pid_check.rb', line 13 def run stale = stale_pid_files if stale.empty? Result.new(name: name, status: :pass, message: 'No stale PID files') else rm_cmds = stale.map { |f| "rm #{f}" }.join('; ') Result.new( name: name, status: :warn, message: "Stale PID file(s): #{stale.join(', ')}", prescription: "Remove with: #{rm_cmds}", auto_fixable: true ) end end |