daemonite 0.5.5 → 0.6.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.
- checksums.yaml +4 -4
- data/daemonite.gemspec +1 -1
- data/lib/daemonite.rb +15 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd02605e10df3a5a47877ab9a0c1212eb565a7606cdcdee6b2339cfd628bacf8
|
4
|
+
data.tar.gz: a89cd8b6da35b87c7ac679b607bc4ae8886546402218bcbe9367d7281ffff4e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f31aa4941704d843513bec86f6e4cd6049b95c853c9c65fe7b80d6ede6148be45b069fadb06ffe8be3f77f93d483bdc8da648a9f5ac980e44a525bcb78c7a76b
|
7
|
+
data.tar.gz: 17f2e8d7561787f8f2ed6ecfa95d62d3af8a4eb5e29a000413fb48ca53ce7d4bb7b45921d788c713c6ab65a23594e3bb62034b2204e2a05da7098ac0e283d664
|
data/daemonite.gemspec
CHANGED
data/lib/daemonite.rb
CHANGED
@@ -33,7 +33,8 @@ module Daemonism
|
|
33
33
|
:runtime_proc => nil,
|
34
34
|
:cmdl_info => nil,
|
35
35
|
:cmdl_parsing => true,
|
36
|
-
:cmdl_operation => 'start'
|
36
|
+
:cmdl_operation => 'start',
|
37
|
+
:kill_amount => 100
|
37
38
|
}
|
38
39
|
|
39
40
|
def daemonism(opts={},&block)
|
@@ -128,8 +129,19 @@ module Daemonism
|
|
128
129
|
else
|
129
130
|
puts "Server #{opts[:cmdl_info].nil? ? '' : '(' + opts[:cmdl_info].to_s + ') '}stopped"
|
130
131
|
puts "Waiting while server goes down ..."
|
132
|
+
count = 0
|
131
133
|
while status.call
|
132
|
-
|
134
|
+
if count > opts[:kill_amount]
|
135
|
+
Process.kill "SIGKILL", pid
|
136
|
+
File.unlink(opts[:basepath] + '/' + opts[:pidfile])
|
137
|
+
else
|
138
|
+
if opts[:cmdl_operation] == 'stop'
|
139
|
+
Process.kill "SIGTERM", pid
|
140
|
+
else
|
141
|
+
Process.kill "SIGHUP", pid
|
142
|
+
end
|
143
|
+
end
|
144
|
+
count += 1
|
133
145
|
sleep 0.3
|
134
146
|
end
|
135
147
|
end
|
@@ -147,7 +159,7 @@ module Daemonism
|
|
147
159
|
@@daemonism_restart = true
|
148
160
|
|
149
161
|
retain = $stdout.dup
|
150
|
-
Process.daemon
|
162
|
+
Process.daemon unless opts[:verbose]
|
151
163
|
retain.puts "Server #{opts[:cmdl_info].nil? ? '' : '(' + opts[:cmdl_info].to_s + ') '}started as PID:#{Process.pid}"
|
152
164
|
File.write(opts[:basepath] + '/' + opts[:pidfile],Process.pid) # after daemon, so that we get the forked pid
|
153
165
|
Dir.chdir(opts[:basepath])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daemonite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Daemonite - Process.daemon and argparse wrapper for loopies.
|
14
14
|
email: juergen.mangler@gmail.com
|