daemons 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = Daemons Version 0.4.2
1
+ = Daemons Version 0.4.3
2
2
 
3
3
  (See Releases for release-specific information)
4
4
 
data/Releases CHANGED
@@ -1,5 +1,14 @@
1
1
  = Daemons Release History
2
2
 
3
+ == Release 0.4.3: November 29, 2005
4
+
5
+ * New Option: You can specify the name of the application with :app_name
6
+ on calling Daemons.run. This will be used to contruct the name of the pid files
7
+ and log files. Defaults to the basename of the script. (thanks to Stephen R. Veit)
8
+
9
+ * Bugfix: Handle the case where no controller options are given when calling Daemons,
10
+ just options after "--". (thanks to Stephen R. Veit)
11
+
3
12
 
4
13
  == Release 0.4.2: November 15, 2005
5
14
 
data/lib/daemons.rb CHANGED
@@ -59,7 +59,7 @@ require 'daemons/controller'
59
59
  #
60
60
  module Daemons
61
61
 
62
- VERSION = "0.4.2"
62
+ VERSION = "0.4.3"
63
63
 
64
64
  require 'daemons/daemonize'
65
65
 
@@ -79,6 +79,10 @@ module Daemons
79
79
  # +options+:: A hash that may contain one or more of the options listed below
80
80
  #
81
81
  # === Options:
82
+ # <tt>:app_name</tt>:: The name of the application. This will be
83
+ # used to contruct the name of the pid files
84
+ # and log files. Defaults to the basename of
85
+ # the script.
82
86
  # <tt>:dir_mode</tt>:: Either <tt>:script</tt> (the directory for writing the pid files to
83
87
  # given by <tt>:dir</tt> is interpreted relative
84
88
  # to the script location given by +script+) or <tt>:normal</tt> (the directory given by
@@ -99,6 +103,7 @@ module Daemons
99
103
  #
100
104
  # === Example:
101
105
  # options = {
106
+ # :app_name => "my_app",
102
107
  # :dir_mode => :script,
103
108
  # :dir => 'pids',
104
109
  # :multiple => true,
@@ -248,7 +248,16 @@ module Daemons
248
248
  return
249
249
  end
250
250
 
251
- Process.kill('TERM', @pid.pid)
251
+ # Catch errors when trying to kill a process that doesn't
252
+ # exist. This happens when the process quits and hasn't been
253
+ # restarted by the monitor yet. By catching the error, we allow the
254
+ # pid file clean-up to occur.
255
+ begin
256
+ Process.kill('TERM', @pid.pid)
257
+ rescue Errno::ESRCH => e
258
+ puts "#{e} #{@pid.pid}"
259
+ puts "deleting pid-file."
260
+ end
252
261
 
253
262
  # We try to remove the pid-files by ourselves, in case the application
254
263
  # didn't clean it up.
@@ -22,10 +22,14 @@ module Daemons
22
22
  @options = options
23
23
  @argv = argv
24
24
 
25
+ # Allow an app_name to be specified. If not specified use the
26
+ # basename of the script.
27
+ @app_name = options[:app_name]
28
+
25
29
  if options[:script]
26
30
  @script = File.expand_path(options[:script])
27
31
 
28
- @app_name = File.split(@script)[1]
32
+ @app_name ||= File.split(@script)[1]
29
33
  end
30
34
 
31
35
  @command, @controller_part, @app_part = Controller.split_argv(argv)
@@ -113,7 +117,9 @@ module Daemons
113
117
  end
114
118
 
115
119
  if i = argv.index('--')
116
- controller_part = argv[0..i-1]
120
+ # Handle the case where no controller options are given, just
121
+ # options after "--" as well (i == 0)
122
+ controller_part = (i == 0 ? [] : argv[0..i-1])
117
123
  app_part = argv[i+1..-1]
118
124
  else
119
125
  controller_part = argv[0..-1]
metadata CHANGED
@@ -1,86 +1,84 @@
1
- --- !ruby/object:Gem::Specification
1
+ !ruby/object:Gem::Specification
2
2
  rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: daemons
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.2
7
- date: 2005-11-15 00:00:00 +01:00
6
+ version: 0.4.3
7
+ date: 2005-11-29 00:00:00 +01:00
8
8
  summary: A toolkit to create and control daemons in different ways
9
9
  require_paths:
10
- - lib
10
+ - lib
11
11
  email: th.uehlinger@gmx.ch
12
12
  homepage: http://daemons.rubyforge.org
13
13
  rubyforge_project: daemons
14
- description: "Daemons provides an easy way to wrap existing ruby scripts (for example a
15
- self-written server) to be run as a daemon and to be controlled by simple
16
- start/stop/restart commands. You can also call blocks as daemons and control
17
- them from the parent or just daemonize the current process. Besides this basic
18
- functionality, daemons offers many advanced features like exception backtracing
19
- and logging (in case your ruby script crashes) and monitoring and automatic
20
- restarting of your processes if they crash."
14
+ description: Daemons provides an easy way to wrap existing ruby scripts (for example a self-written server) to be run as a daemon and to be controlled by simple start/stop/restart commands. You can also call blocks as daemons and control them from the parent or just daemonize the current process. Besides this basic functionality, daemons offers many advanced features like exception backtracing and logging (in case your ruby script crashes) and monitoring and automatic restarting of your processes if they crash.
21
15
  autorequire: daemons
22
16
  default_executable:
23
17
  bindir: bin
24
18
  has_rdoc: true
25
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
26
20
  requirements:
27
- -
28
- - ">"
29
- - !ruby/object:Gem::Version
30
- version: 0.0.0
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
31
24
  version:
32
25
  platform: ruby
33
26
  signing_key:
34
27
  cert_chain:
35
28
  authors:
36
- - Thomas Uehlinger
29
+ - Thomas Uehlinger
37
30
  files:
38
- - Rakefile
39
- - Releases
40
- - TODO
41
- - README
42
- - setup.rb
43
- - lib/daemons.rb
44
- - lib/daemons/cmdline.rb
45
- - lib/daemons/exceptions.rb
46
- - lib/daemons/daemonize.rb
47
- - lib/daemons/pidfile.rb
48
- - lib/daemons/monitor.rb
49
- - lib/daemons/application_group.rb
50
- - lib/daemons/controller.rb
51
- - lib/daemons/pid.rb
52
- - lib/daemons/pidmem.rb
53
- - lib/daemons/application.rb
54
- - test/tmp
55
- - test/testapp.rb
56
- - test/test1.rb
57
- - test/call_as_daemon.rb
58
- - test/tc_main.rb
59
- - examples/run
60
- - examples/call
61
- - examples/daemonize
62
- - examples/run/ctrl_exec.rb
63
- - examples/run/ctrl_exit.rb
64
- - examples/run/ctrl_multiple.rb
65
- - examples/run/myserver_crashing.rb.output
66
- - examples/run/ctrl_normal.rb
67
- - examples/run/ctrl_monitor.rb
68
- - examples/run/myserver.rb
69
- - examples/run/myserver_crashing.rb
70
- - examples/run/ctrl_ontop.rb
71
- - examples/run/myserver_exiting.rb
72
- - examples/run/ctrl_crash.rb
73
- - examples/call/call_monitor.rb
74
- - examples/call/call.rb
75
- - examples/daemonize/daemonize.rb
31
+ - Rakefile
32
+ - Releases
33
+ - TODO
34
+ - README
35
+ - setup.rb
36
+ - lib/daemons.rb
37
+ - lib/daemons/cmdline.rb
38
+ - lib/daemons/exceptions.rb
39
+ - lib/daemons/daemonize.rb
40
+ - lib/daemons/pidfile.rb
41
+ - lib/daemons/monitor.rb
42
+ - lib/daemons/application_group.rb
43
+ - lib/daemons/controller.rb
44
+ - lib/daemons/pid.rb
45
+ - lib/daemons/pidmem.rb
46
+ - lib/daemons/application.rb
47
+ - test/tmp
48
+ - test/testapp.rb
49
+ - test/test1.rb
50
+ - test/call_as_daemon.rb
51
+ - test/tc_main.rb
52
+ - examples/run
53
+ - examples/call
54
+ - examples/daemonize
55
+ - examples/run/ctrl_exec.rb
56
+ - examples/run/ctrl_exit.rb
57
+ - examples/run/ctrl_multiple.rb
58
+ - examples/run/myserver_crashing.rb.output
59
+ - examples/run/ctrl_normal.rb
60
+ - examples/run/ctrl_monitor.rb
61
+ - examples/run/myserver.rb
62
+ - examples/run/myserver_crashing.rb
63
+ - examples/run/ctrl_ontop.rb
64
+ - examples/run/myserver_exiting.rb
65
+ - examples/run/ctrl_crash.rb
66
+ - examples/call/call_monitor.rb
67
+ - examples/call/call.rb
68
+ - examples/daemonize/daemonize.rb
76
69
  test_files:
77
- - test/tc_main.rb
70
+ - test/tc_main.rb
78
71
  rdoc_options: []
72
+
79
73
  extra_rdoc_files:
80
- - README
81
- - Releases
82
- - TODO
74
+ - README
75
+ - Releases
76
+ - TODO
83
77
  executables: []
78
+
84
79
  extensions: []
80
+
85
81
  requirements: []
86
- dependencies: []
82
+
83
+ dependencies: []
84
+