daemons 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/Releases +5 -0
- data/lib/daemons.rb +13 -10
- data/lib/daemons/application.rb +5 -1
- data/lib/daemons/application_group.rb +10 -7
- data/lib/daemons/controller.rb +1 -1
- data/lib/daemons/monitor.rb +1 -1
- data/lib/daemons/pidfile.rb +2 -2
- data/lib/daemons/version.rb +1 -1
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87cdbadcf8ce1d77533557b7d0f359dc5a750fe5
|
4
|
+
data.tar.gz: 00ca7e0da7abb35af6ca5ed389c9903f5212ee4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '092c646fb307604e652b88e00444b55b1cc332add1657e0351fee23093e86caec7413f507e599538b3cfcf28e28de5ec16003e225505fb0661cc837af622a57b'
|
7
|
+
data.tar.gz: 87e93b5cf8209905b2d9aa0404461f35ef06ab7e6c653195402112fea17583cd8e2c135429d354a8899da86bf691d4c70c127418f8029d05cd6747b89c0988f7
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Ruby Daemons
|
2
2
|
============
|
3
|
-
[![Code Climate](https://codeclimate.com/github/acuppy/daemons/badges/gpa.svg)](https://codeclimate.com/github/acuppy/daemons)[![Test Coverage](https://circleci.com/gh/acuppy/daemons.svg?style=shield&circle-token=a4f96fd41f7682661d6543e30207427ac8870c0d)](https://circleci.com/gh/acuppy/daemons)
|
3
|
+
[![Build Status](https://travis-ci.org/thuehlinger/daemons.svg?branch=master)](https://travis-ci.org/thuehlinger/daemons)[![Code Climate](https://codeclimate.com/github/acuppy/daemons/badges/gpa.svg)](https://codeclimate.com/github/acuppy/daemons)[![Test Coverage](https://circleci.com/gh/acuppy/daemons.svg?style=shield&circle-token=a4f96fd41f7682661d6543e30207427ac8870c0d)](https://circleci.com/gh/acuppy/daemons)
|
4
4
|
|
5
5
|
Daemons provides an easy way to wrap existing ruby scripts (for example a self-written server)
|
6
6
|
to be _run as a daemon_ and to be _controlled by simple start/stop/restart commands_.
|
@@ -204,4 +204,4 @@ Daemons.run('myserver.rb', { show_status_callback: :custom_show_status })
|
|
204
204
|
Author
|
205
205
|
------
|
206
206
|
|
207
|
-
Written 2005-
|
207
|
+
Written 2005-2017 by Thomas Uehlinger, 2014-2016 by Aaron Stone.
|
data/Releases
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= Daemons Release History
|
2
2
|
|
3
|
+
== Release 1.2.5: October 22, 2017
|
4
|
+
|
5
|
+
* In Application#stop, call zap, not cleanup on the pidfile (thanks to wevanscfi)
|
6
|
+
* Use File.expand_path on and output and log files (thanks to Dave Harris)
|
7
|
+
|
3
8
|
== Release 1.2.4: August 1, 2016
|
4
9
|
|
5
10
|
* add :shush option
|
data/lib/daemons.rb
CHANGED
@@ -238,23 +238,26 @@ module Daemons
|
|
238
238
|
# end
|
239
239
|
#
|
240
240
|
def call(options = {}, &block)
|
241
|
-
|
242
|
-
|
243
|
-
|
241
|
+
new_app = Daemons.new(options, &block)
|
242
|
+
new_app.start
|
243
|
+
new_app
|
244
|
+
end
|
245
|
+
module_function :call
|
244
246
|
|
245
|
-
|
246
|
-
|
247
|
+
# Create a new Daemon application, like <tt>Daemons.call</tt>, but will not start it automatically
|
248
|
+
def new(options = {}, &block)
|
249
|
+
fail 'Daemons.call: no block given' unless block_given?
|
247
250
|
|
248
251
|
options[:app_name] ||= 'proc'
|
252
|
+
options[:proc] = Proc.new
|
253
|
+
options[:mode] = :proc
|
254
|
+
options[:dir_mode] = :normal
|
249
255
|
|
250
256
|
@group ||= ApplicationGroup.new(options[:app_name], options)
|
251
257
|
|
252
|
-
|
253
|
-
new_app.start
|
254
|
-
|
255
|
-
new_app
|
258
|
+
@group.new_application(options)
|
256
259
|
end
|
257
|
-
module_function :
|
260
|
+
module_function :new
|
258
261
|
|
259
262
|
# Daemonize the currently runnig process, i.e. the calling process will become a daemon.
|
260
263
|
#
|
data/lib/daemons/application.rb
CHANGED
@@ -28,6 +28,10 @@ module Daemons
|
|
28
28
|
@options = group.options.dup
|
29
29
|
@options.update(add_options)
|
30
30
|
|
31
|
+
['dir', 'log_dir', 'logfilename', 'output_logfilename'].each do |k|
|
32
|
+
@options[k] = File.expand_path(@options[k]) if @options.key?(k)
|
33
|
+
end
|
34
|
+
|
31
35
|
@dir_mode = @dir = @script = nil
|
32
36
|
|
33
37
|
@force_kill_waittime = @options[:force_kill_waittime] || 20
|
@@ -416,7 +420,7 @@ module Daemons
|
|
416
420
|
unless Pid.running?(pid)
|
417
421
|
# We try to remove the pid-files by ourselves, in case the application
|
418
422
|
# didn't clean it up.
|
419
|
-
|
423
|
+
zap!
|
420
424
|
|
421
425
|
@report.stopped_process(group.app_name, pid)
|
422
426
|
$stdout.flush
|
@@ -23,19 +23,22 @@ module Daemons
|
|
23
23
|
@app_name = app_name
|
24
24
|
@options = options
|
25
25
|
|
26
|
-
if options[:script]
|
27
|
-
@script = File.expand_path(options[:script])
|
26
|
+
if @options[:script]
|
27
|
+
@script = File.expand_path(@options[:script])
|
28
28
|
end
|
29
29
|
|
30
30
|
@monitor = nil
|
31
31
|
|
32
|
-
@multiple = options[:multiple] || false
|
32
|
+
@multiple = @options[:multiple] || false
|
33
33
|
|
34
|
-
@dir_mode = options[:dir_mode] || :script
|
35
|
-
|
34
|
+
@dir_mode = @options[:dir_mode] || :script
|
35
|
+
['dir'].each do |k|
|
36
|
+
@options[k] = File.expand_path(@options[k]) if @options.key?(k)
|
37
|
+
end
|
38
|
+
@dir = @options[:dir] || ''
|
36
39
|
|
37
|
-
@keep_pid_files = options[:keep_pid_files] || false
|
38
|
-
@no_pidfiles = options[:no_pidfiles] || false
|
40
|
+
@keep_pid_files = @options[:keep_pid_files] || false
|
41
|
+
@no_pidfiles = @options[:no_pidfiles] || false
|
39
42
|
|
40
43
|
@applications = []
|
41
44
|
end
|
data/lib/daemons/controller.rb
CHANGED
data/lib/daemons/monitor.rb
CHANGED
@@ -107,7 +107,7 @@ module Daemons
|
|
107
107
|
end
|
108
108
|
rescue ::Exception => e
|
109
109
|
$stderr.puts "exception while trying to stop monitor process #{pid}: #{e}"
|
110
|
-
$stderr.puts
|
110
|
+
$stderr.puts "deleting pid-file."
|
111
111
|
end
|
112
112
|
|
113
113
|
# We try to remove the pid-files by ourselves, in case the monitor
|
data/lib/daemons/pidfile.rb
CHANGED
data/lib/daemons/version.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daemons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Uehlinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry-byebug
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.0.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 3.0.0
|
69
69
|
description: |2
|
70
70
|
Daemons provides an easy way to wrap existing ruby scripts (for example a
|
71
71
|
self-written server) to be run as a daemon and to be controlled by simple
|
@@ -137,17 +137,17 @@ require_paths:
|
|
137
137
|
- lib
|
138
138
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
|
-
- -
|
140
|
+
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
|
-
- -
|
145
|
+
- - ">="
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.5.2
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: A toolkit to create and control daemons in different ways
|