Sha256: 10501b3c0f48dd3d8b4caf28b7c3859e98fe7a24b90c6d43afa1bbbdae3663fc
Contents?: true
Size: 976 Bytes
Versions: 2
Compression:
Stored size: 976 Bytes
Contents
#!/usr/bin/env ruby require 'rubygems' require 'daemons' require 'logger' require File.dirname(__FILE__) + '/../lib/heartbeat-client' begin puts "Using config in your home directory" @config = YAML.load(File.read("#{ENV['HOME']}/.heartbeat-client.yml")) rescue Errno::ENOENT raise "heartbeat-client.yml expected in ~/.heartbeat-client.yml" end unless @config['apikey'] puts "API Key not found!" exit end unless @config['endpoint'] puts "Service Endpoint not found!" exit end if ARGV and ARGV.size == 1 Daemons.run_proc('heartbeat-client.rb', :dir => File.join('/tmp'), :monitor => true, :backtrace => true, :monitor => true) do Heartbeat.log = Logger.new('/tmp/heartbeat.log') loop do begin Heartbeat.create(@config['apikey'], @config['endpoint'], @config['name']) rescue => e puts e.message end GC.start sleep(30) end end else puts "Please provide a command to hbc (start|stop|run)!" end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
heartbeat-client-0.3.2 | bin/hbc |
heartbeat-client-0.3.1 | bin/hbc |