Class: Epi::Cli::Commands::Job

Inherits:
Epi::Cli::Command show all
Defined in:
lib/epi/cli/commands/job.rb

Instance Attribute Summary

Attributes inherited from Epi::Cli::Command

#args

Instance Method Summary collapse

Methods inherited from Epi::Cli::Command

#initialize, #need_root!, run

Constructor Details

This class inherits a constructor from Epi::Cli::Command

Instance Method Details

#runObject

Raises:



6
7
8
9
10
11
12
13
14
# File 'lib/epi/cli/commands/job.rb', line 6

def run
  id = args.shift
  raise Exceptions::Fatal, 'No job ID given' if id.nil? || id.empty?
  instruction = args.join(' ').strip
  raise Exceptions::Fatal, 'No instruction given' if instruction.empty?
  raise Exceptions::Fatal, 'Invalid instruction' unless
      instruction =~ /^((\d+ )?(more|less)|\d+|pause|resume|reset|max|min|restart)$/
  Epi::Daemon.send job: {id: id, instruction: instruction}
end