Method: Epi::Cli::Commands::Job#run

Defined in:
lib/epi/cli/commands/job.rb

#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