Sha256: b42658c2e94bfcb24f7a7042f4e9272e8de8e85a62a3b6a35e4765e1ff70ac11

Contents?: true

Size: 613 Bytes

Versions: 13

Compression:

Stored size: 613 Bytes

Contents

class Loops::Commands::StartCommand < Loops::Command
  def execute
    # Pid file check
    if Loops::Daemonize.check_pid(Loops.pid_file)
      puts "Can't start, another process exists!"
      exit(1)
    end

    # Daemonization
    if options[:daemonize]
      app_name = "loops monitor: #{options[:args].join(' ') rescue 'all'}\0"
      Loops::Daemonize.daemonize(app_name)
    end

    # Pid file creation
    Loops::Daemonize.create_pid(Loops.pid_file)

    # Workers processing
    engine.start_loops!(options[:args])

    # Workers exited, cleaning up
    File.delete(Loops.pid_file) rescue nil
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
loops-2.0.9 lib/loops/commands/start_command.rb
loops-2.0.8 lib/loops/commands/start_command.rb
loops-2.0.7 lib/loops/commands/start_command.rb
loops-2.0.6 lib/loops/commands/start_command.rb
loops-2.0.5 lib/loops/commands/start_command.rb
loops-2.0.4 lib/loops/commands/start_command.rb
loops-2.0.3 lib/loops/commands/start_command.rb
qik-loops-2.1.4 lib/loops/commands/start_command.rb
loops-2.0.2 lib/loops/commands/start_command.rb
qik-loops-2.1.3 lib/loops/commands/start_command.rb
qik-loops-2.1.0 lib/loops/commands/start_command.rb
loops-2.0.1 lib/loops/commands/start_command.rb
loops-2.0.0 lib/loops/commands/start_command.rb