daemontools 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/daemontools.rb +30 -2
- data/lib/daemontools/version.rb +1 -1
- 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: 1194e2ccd6aec2798db9597a91a8ff982752be9174cf4a48f3ef83af1e14fb6a
|
4
|
+
data.tar.gz: e10ac3fc9c169034077b10bb85a523cdaded4d0b8c9832906c01f2cd1e96876d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fba606a33024d89ece9a27b3c931bee6fcdcbc7ab841d5a238e16a21d338b6c68a56091ca53c058f7bc159a2a77f0c4a3119bec3604e143524a76244b7fef39
|
7
|
+
data.tar.gz: 1c5569f2376e70a46f726695d6ac0347133c6158881c4de1d62e2bb3384682b852a4cfe647dc3e26f98a5102d812d0ec9923309c50e5a33ee29d040e5dd29f42
|
data/lib/daemontools.rb
CHANGED
@@ -6,15 +6,20 @@ require 'erb'
|
|
6
6
|
|
7
7
|
module Daemontools
|
8
8
|
class << self
|
9
|
-
attr_accessor :svc_root, :log_root
|
9
|
+
attr_accessor :svc_root, :log_root, :tmp_root
|
10
10
|
end
|
11
11
|
@svc_root = '/etc/service'
|
12
12
|
@log_root = '/var/log/svc'
|
13
|
+
@tmp_root = '/tmp'
|
13
14
|
|
14
15
|
def self.exists?(name)
|
15
16
|
check_service_exists(name, false)
|
16
17
|
end
|
17
18
|
|
19
|
+
def self.tmp_exists?(name)
|
20
|
+
Dir.exists?("#{@tmp_root}/daemontools_service_#{name}")
|
21
|
+
end
|
22
|
+
|
18
23
|
def self.status(name)
|
19
24
|
check_service_exists(name)
|
20
25
|
r = `sudo svstat #{@path} 2>&1`
|
@@ -57,6 +62,29 @@ module Daemontools
|
|
57
62
|
true
|
58
63
|
end
|
59
64
|
|
65
|
+
def self.add_empty_tmp(name)
|
66
|
+
path = "#{@tmp_root}/daemontools_service_#{name}"
|
67
|
+
Dir.mkdir(path) unless Dir.exists?(path)
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.move_tmp(name)
|
72
|
+
tmp_path = "#{@tmp_root}/daemontools_service_#{name}"
|
73
|
+
svc_path = "#{@svc_root}/#{name}"
|
74
|
+
|
75
|
+
r = `mv #{tmp_path} #{svc_path}`
|
76
|
+
raise r if $?.exitstatus != 0
|
77
|
+
raise r if ! r.empty?
|
78
|
+
|
79
|
+
now = Time.now.to_f
|
80
|
+
while `sudo svstat #{svc_path} 2>&1`.match(/unable to open/i)
|
81
|
+
raise "Timeout wait for svc add service" if Time.now.to_f - now > 10
|
82
|
+
sleep 0.1
|
83
|
+
end
|
84
|
+
|
85
|
+
true
|
86
|
+
end
|
87
|
+
|
60
88
|
def self.add(name, command, options = {})
|
61
89
|
@name = name
|
62
90
|
@command = command
|
@@ -91,7 +119,7 @@ module Daemontools
|
|
91
119
|
end
|
92
120
|
|
93
121
|
def self.delete(name, rm_cmd = nil)
|
94
|
-
|
122
|
+
return false unless exists?(name)
|
95
123
|
stop(name)
|
96
124
|
cmd = rm_cmd.nil? ? "sudo rm -rf #{@path} 2>&1" : "#{rm_cmd} #{@path}"
|
97
125
|
r = `#{cmd}`
|
data/lib/daemontools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daemontools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|