slackbot_frd 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/slackbot-frd +13 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04cee0faa28be4076894f5b61e49fb303430c138
|
4
|
+
data.tar.gz: 1e72aadc3cab4e5e7a7760a5445a13e28e661028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad3b57ef770214cc5696afcb3bd1d12a232cad10b38068760dc4a88513fc53c990a0a2d61e0e7039ef1e5b1dabe8cc09b27bd86ea1615a5a2aa4a0e2a7016da6
|
7
|
+
data.tar.gz: 38438e35bba579a89a20ac5c123582981c9ad7eef0f5460756c50b10fbbed03f3c3ebb46c321887ca193f373fa2ec22f7880bed817889d1b613ce7e6af0b58d1
|
data/bin/slackbot-frd
CHANGED
@@ -32,6 +32,15 @@ class SlackbotFrdBin < Thor
|
|
32
32
|
# TODO
|
33
33
|
end
|
34
34
|
|
35
|
+
desc "status", "Report status on daemon procs"
|
36
|
+
def status
|
37
|
+
if running?(watcher_pid)
|
38
|
+
puts "Daemon running as pid '#{watcher_pid}'".green
|
39
|
+
else
|
40
|
+
puts "Daemon not running".red
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
35
44
|
desc "genconfig", "Generate a skeleton config file"
|
36
45
|
long_desc <<-LONGDESC
|
37
46
|
genconfig will generate a skeleton config file that
|
@@ -99,7 +108,7 @@ class SlackbotFrdBin < Thor
|
|
99
108
|
end
|
100
109
|
|
101
110
|
if daemonize
|
102
|
-
|
111
|
+
Process.fork{ watch_connection(bots, token, botdir, true) }
|
103
112
|
else
|
104
113
|
watch_connection(bots, token, botdir)
|
105
114
|
end
|
@@ -169,6 +178,7 @@ class SlackbotFrdBin < Thor
|
|
169
178
|
private
|
170
179
|
def watch_connection(bots, token, botdir, daemonize = false)
|
171
180
|
Process.daemon if daemonize
|
181
|
+
set_watcher_pid(Process.pid)
|
172
182
|
until errors
|
173
183
|
pid = Process.fork { BotStarter.start_bots(ERROR_FILE, token, botdir, bots) }
|
174
184
|
set_connection_pid(pid)
|
@@ -205,13 +215,13 @@ class SlackbotFrdBin < Thor
|
|
205
215
|
|
206
216
|
private
|
207
217
|
def watcher_pid
|
208
|
-
File.read(PID_FILE_WATCHER).to_i if File.exists?(PID_FILE_WATCHER)
|
218
|
+
return File.read(PID_FILE_WATCHER).to_i if File.exists?(PID_FILE_WATCHER)
|
209
219
|
nil
|
210
220
|
end
|
211
221
|
|
212
222
|
private
|
213
223
|
def connection_pid
|
214
|
-
File.read(PID_FILE_CONNECTION).to_i if File.exists?(PID_FILE_CONNECTION)
|
224
|
+
return File.read(PID_FILE_CONNECTION).to_i if File.exists?(PID_FILE_CONNECTION)
|
215
225
|
nil
|
216
226
|
end
|
217
227
|
|