seamusabshere-daemon-spawn 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/daemon_spawn.rb +4 -3
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
data/lib/daemon_spawn.rb CHANGED
@@ -40,7 +40,7 @@ module DaemonSpawn
40
40
  STDIN.reopen "/dev/null"
41
41
  STDOUT.reopen log
42
42
  STDERR.reopen STDOUT
43
- trap("TERM") {daemon.stop; exit}
43
+ trap(daemon.signal) {daemon.stop; exit}
44
44
  daemon.start(args)
45
45
  end
46
46
  puts "#{daemon.app_name} started."
@@ -49,7 +49,7 @@ module DaemonSpawn
49
49
  def self.stop(daemon) #:nodoc:
50
50
  if pid = daemon.pid
51
51
  FileUtils.rm(daemon.pid_file)
52
- Process.kill("TERM", pid)
52
+ Process.kill(daemon.signal, pid)
53
53
  begin
54
54
  Process.wait(pid)
55
55
  rescue Errno::ECHILD
@@ -66,10 +66,11 @@ module DaemonSpawn
66
66
  end
67
67
 
68
68
  class Base
69
- attr_accessor :log_file, :pid_file, :sync_log, :working_dir, :app_name, :singleton, :index
69
+ attr_accessor :log_file, :pid_file, :sync_log, :working_dir, :app_name, :singleton, :index, :signal
70
70
 
71
71
  def initialize(opts = {})
72
72
  raise 'You must specify a :working_dir' unless opts[:working_dir]
73
+ self.signal = opts[:signal] || "TERM"
73
74
  self.working_dir = opts[:working_dir]
74
75
  self.app_name = opts[:application] || classname
75
76
  self.pid_file = opts[:pid_file] || File.join(working_dir, 'tmp', 'pids', app_name + extension)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alex Vollmer