Sha256: 78b90accb38cdef434201d8ff5fc2066912a44f1b45d2a7428559d3db379501c

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

#!/usr/bin/ruby

$LOAD_PATH.unshift File.expand_path("../../lib", File.realdirpath(__FILE__))

require 'optparse'

options = {}

version = "1.0.0"

options        = {}
version        = "1.0.0"
daemonize_help = "run daemonized in the background (default: false)"
pidfile_help   = "the pid filename"
logfile_help   = "the log filename"
debug_help     = "set $DEBUG to true"
warn_help      = "enable warnings"

op = OptionParser.new
op.banner =  "A background service that supervises the Particle firmware"
op.separator ""
op.separator "Usage: daemon [options]"
op.separator ""

op.separator "Process options:"
op.on("-d", "--daemon",   daemonize_help)      { options[:daemonize] = true  }
op.on("-p", "--pidfile PIDFILE", pidfile_help) { |value| options[:pidfile]   = value }
op.on("-l", "--logfile LOGFILE", logfile_help) { |value| options[:logfile]   = value }
op.separator ""

op.separator "Ruby options:"
op.on(      "--debug",        debug_help)   { $DEBUG = true }
op.on(      "--warn",         warn_help)    { $-w = true    }
op.separator ""

op.separator "Common options:"
op.on("-h", "--help")    { puts op.to_s; exit }
op.on("-v", "--version") { puts version; exit }
op.separator ""

op.parse!(ARGV)

require 'particlepi/daemon'
require 'particlepi/agent'
ParticlePi::Daemon.new(options).run! do |daemon|
  ParticlePi::Agent.new.run!(daemon)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
particlepi-0.1.0 bin/particlepi-agent