alexvollmer-daemon-spawn 0.1.0 → 0.2.0
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.
- data/History.txt +5 -0
- data/Manifest.txt +0 -1
- data/Rakefile +2 -2
- data/examples/echo_server.rb +4 -2
- data/lib/daemon-spawn.rb +12 -5
- metadata +12 -11
- data/bin/daemon-spawn +0 -0
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -4,8 +4,8 @@ require 'rubygems'
|
|
4
4
|
require 'hoe'
|
5
5
|
require './lib/daemon-spawn.rb'
|
6
6
|
|
7
|
-
Hoe.
|
8
|
-
p.developer('Alex Vollmer', 'alex@
|
7
|
+
Hoe.spec('daemon-spawn') do |p|
|
8
|
+
p.developer('Alex Vollmer', 'alex.vollmer@gmail.com')
|
9
9
|
end
|
10
10
|
|
11
11
|
# vim: syntax=Ruby
|
data/examples/echo_server.rb
CHANGED
data/lib/daemon-spawn.rb
CHANGED
@@ -3,7 +3,7 @@ require "fileutils"
|
|
3
3
|
# Large portions of this were liberally stolen from the
|
4
4
|
# 'simple-daemon' project at http://simple-daemon.rubyforge.org/
|
5
5
|
module DaemonSpawn
|
6
|
-
VERSION = '0.
|
6
|
+
VERSION = '0.2.0'
|
7
7
|
|
8
8
|
def self.usage(msg=nil) #:nodoc:
|
9
9
|
print "#{msg}, " if msg
|
@@ -50,6 +50,10 @@ module DaemonSpawn
|
|
50
50
|
if pid = daemon.pid
|
51
51
|
FileUtils.rm(daemon.pid_file)
|
52
52
|
Process.kill("TERM", pid)
|
53
|
+
begin
|
54
|
+
Process.wait(pid)
|
55
|
+
rescue Errno::ECHILD
|
56
|
+
end
|
53
57
|
else
|
54
58
|
puts "Pid file not found. Is the daemon started?"
|
55
59
|
exit
|
@@ -120,11 +124,14 @@ module DaemonSpawn
|
|
120
124
|
# - <tt>:sync_log</tt> -- indicate whether or not to sync log IO
|
121
125
|
# - <tt>:singleton</tt> -- If set to true, only one instance is
|
122
126
|
# allowed to start
|
123
|
-
|
124
|
-
|
127
|
+
# args must begin with 'start', 'stop', 'status', or 'restart'.
|
128
|
+
# The first token will be removed and any remaining arguments
|
129
|
+
# passed to the daemon's start method.
|
130
|
+
def self.spawn!(opts={ }, args=ARGV)
|
131
|
+
case args.size > 0 && args.shift
|
125
132
|
when 'start'
|
126
133
|
daemon = self.new(opts)
|
127
|
-
DaemonSpawn.start(daemon,
|
134
|
+
DaemonSpawn.start(daemon, args)
|
128
135
|
when 'stop'
|
129
136
|
daemon = self.new(opts)
|
130
137
|
DaemonSpawn.stop(daemon)
|
@@ -138,7 +145,7 @@ module DaemonSpawn
|
|
138
145
|
when 'restart'
|
139
146
|
daemon = self.new(opts)
|
140
147
|
DaemonSpawn.stop(daemon)
|
141
|
-
DaemonSpawn.start(daemon,
|
148
|
+
DaemonSpawn.start(daemon, args)
|
142
149
|
when '-h', '--help', 'help'
|
143
150
|
DaemonSpawn.usage
|
144
151
|
exit
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexvollmer-daemon-spawn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Vollmer
|
@@ -9,23 +9,24 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
13
|
-
default_executable:
|
12
|
+
date: 2009-09-21 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hoe
|
17
|
+
type: :development
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
21
|
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
23
|
+
version: 2.3.3
|
23
24
|
version:
|
24
25
|
description: Daemon launching and management made dead simple. With daemon-spawn you can start, stop and restart processes that run in the background. Processed are tracked by a simple PID file written to disk. In addition, you can choose to either execute ruby in your daemonized process or 'exec' another process altogether (handy for wrapping other services).
|
25
26
|
email:
|
26
|
-
- alex@
|
27
|
-
executables:
|
28
|
-
|
27
|
+
- alex.vollmer@gmail.com
|
28
|
+
executables: []
|
29
|
+
|
29
30
|
extensions: []
|
30
31
|
|
31
32
|
extra_rdoc_files:
|
@@ -37,12 +38,12 @@ files:
|
|
37
38
|
- Manifest.txt
|
38
39
|
- README.txt
|
39
40
|
- Rakefile
|
40
|
-
- bin/daemon-spawn
|
41
41
|
- lib/daemon-spawn.rb
|
42
42
|
- test/test_daemon-spawn.rb
|
43
43
|
- examples/echo_server.rb
|
44
|
-
has_rdoc:
|
44
|
+
has_rdoc: false
|
45
45
|
homepage: http://github.com/alexvollmer/daemon-spawn
|
46
|
+
licenses:
|
46
47
|
post_install_message:
|
47
48
|
rdoc_options:
|
48
49
|
- --main
|
@@ -64,9 +65,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
65
|
requirements: []
|
65
66
|
|
66
67
|
rubyforge_project: daemon-spawn
|
67
|
-
rubygems_version: 1.
|
68
|
+
rubygems_version: 1.3.5
|
68
69
|
signing_key:
|
69
|
-
specification_version:
|
70
|
+
specification_version: 3
|
70
71
|
summary: Daemon launching and management made dead simple
|
71
72
|
test_files:
|
72
73
|
- test/test_daemon-spawn.rb
|
data/bin/daemon-spawn
DELETED
File without changes
|