Sha256: acca4e0954cf4e49d46c4c903610445485e0660344da57b51c34a698ad74a5a7

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

#!/usr/bin/env ruby

$: << File.dirname(__FILE__) + '/../lib' unless $:.include?(File.dirname(__FILE__) + '/../lib/')

require 'rubygems'
require 'daemons'
require 'fileutils'
require 'flapjack/cli/notifier_manager'
require 'flapjack/patches' # for Daemons

# reassign ARGV so we don't mess with it directly
args = ARGV
args << '--help' if args.size == 0
options = Flapjack::NotifierManagerOptions.parse(args)

worker_path = File.join(File.dirname(__FILE__), 'flapjack-notifier')

# set up pid dir
pid_dir = "/var/run/flapjack/"
unless File.exists?(pid_dir)
  puts "#{pid_dir} doesn't exist."
  exit 2
end

unless File.writable?(pid_dir)
  puts "Can't write to #{pid_dir} - check permissions?"
  exit 2
end

# construct arguments
daemon_args = args
if args.first != "stop"
  # if we're not stopping the daemon, pass options to it
  daemon_args += ['--', '--recipients', options.recipients,
                        '--config', File.expand_path(options.config_filename)]
end

# boot
Daemons.run(worker_path, :ARGV => daemon_args,
                         :multiple => false, 
                         :dir_mode => :normal,
                         :dir => pid_dir)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flapjack-0.5.5 bin/flapjack-notifier-manager
flapjack-0.5.4 bin/flapjack-notifier-manager
flapjack-0.5.3 bin/flapjack-notifier-manager
flapjack-0.5.1 bin/flapjack-notifier-manager