Module: Eye::Process::Validate

Included in:
Eye::Process
Defined in:
lib/eye/process/validate.rb

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Instance Method Details

#validate(config) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/eye/process/validate.rb', line 7

def validate(config)
  if (str = config[:start_command])
    # it should parse with Shellwords and not raise
    spl = Shellwords.shellwords(str) * '#'

    if config[:daemonize]
      if spl =~ %r[sh#\-c|#&&#|;#]
        raise Error, "#{config[:name]}, start_command in daemonize not supported shell concats like '&&'"
      end
    end
  end

  Shellwords.shellwords(config[:stop_command]) if config[:stop_command]
  Shellwords.shellwords(config[:restart_command]) if config[:restart_command]
end