svutil 0.0.7 → 0.0.9
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/lib/svutil.rb +1 -1
- data/lib/svutil/process_manager.rb +7 -5
- metadata +3 -3
data/lib/svutil.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
module SVUtil
|
2
2
|
class ProcessManager
|
3
3
|
def initialize(klass)
|
4
|
-
|
5
|
-
Signal.trap("
|
4
|
+
# TODO: Add ability for users to specify these signals
|
5
|
+
Signal.trap("INT") { shutdown('Interupted') }
|
6
|
+
Signal.trap("TERM") { shutdown('Terminated') }
|
7
|
+
Signal.trap("PIPE") { shutdown('Broken Pipe') }
|
6
8
|
if running?
|
7
9
|
STDERR.puts "There is already a '#{$0}' process running"
|
8
10
|
exit 1
|
@@ -20,14 +22,14 @@ module SVUtil
|
|
20
22
|
STDERR.puts $!
|
21
23
|
STDERR.puts $!.backtrace if SVUtil::config.trace
|
22
24
|
ensure
|
23
|
-
|
25
|
+
shutdown("Process Completed")
|
24
26
|
exit 1
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
30
|
private
|
29
|
-
def shutdown
|
30
|
-
Log.info "Shutting Down"
|
31
|
+
def shutdown(reason = nil)
|
32
|
+
Log.info "Shutting Down (#{reason})"
|
31
33
|
@server_instance.shutdown if @server_instance.respond_to?(:shutdown)
|
32
34
|
remove_pid_file
|
33
35
|
exit 0
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 9
|
9
|
+
version: 0.0.9
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Daniel Draper
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-07-
|
17
|
+
date: 2010-07-19 00:00:00 +09:30
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|