daemonite 0.5.5 → 0.6.0

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/daemonite.gemspec +1 -1
  3. data/lib/daemonite.rb +15 -3
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d80e2f0268b9385c864ebe15b2f0f728b2acbb3d4205115722abd3d308b0267d
4
- data.tar.gz: 5b90f90695c57d08524b5d64d4579f230faa44981abd457e4291ecf806c45629
3
+ metadata.gz: fd02605e10df3a5a47877ab9a0c1212eb565a7606cdcdee6b2339cfd628bacf8
4
+ data.tar.gz: a89cd8b6da35b87c7ac679b607bc4ae8886546402218bcbe9367d7281ffff4e8
5
5
  SHA512:
6
- metadata.gz: 4a6ad8f8b8847dee5cc599e1effc3c68fd5d595688f55cff5db9488a949acb4a176f14197d615d0cb60bd69b1d8cbf96933744085a511cd4bc0124821fcd53aa
7
- data.tar.gz: 399d6e45ecbd5055cec2f0ce6ef4a5f6bc9b478938e70523957568a843f4845a2c5d31c65c5ada3a41e92c2e54bad6725e8e766c10312664281a5aef3578c8fc
6
+ metadata.gz: f31aa4941704d843513bec86f6e4cd6049b95c853c9c65fe7b80d6ede6148be45b069fadb06ffe8be3f77f93d483bdc8da648a9f5ac980e44a525bcb78c7a76b
7
+ data.tar.gz: 17f2e8d7561787f8f2ed6ecfa95d62d3af8a4eb5e29a000413fb48ca53ce7d4bb7b45921d788c713c6ab65a23594e3bb62034b2204e2a05da7098ac0e283d664
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "daemonite"
3
- s.version = "0.5.5"
3
+ s.version = "0.6.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Daemonite - Process.daemon and argparse wrapper for loopies."
@@ -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
- Process.kill "SIGTERM", pid
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(opts[:basepath]) unless opts[:verbose]
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.5.5
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-05-29 00:00:00.000000000 Z
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