mlanett-daemons 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +17 -0
  4. data/LICENSE +29 -0
  5. data/README +223 -0
  6. data/Rakefile +15 -0
  7. data/Releases +126 -0
  8. data/TODO +6 -0
  9. data/daemons.gemspec +27 -0
  10. data/daemons.tmproj +56 -0
  11. data/examples/call/call.rb +56 -0
  12. data/examples/call/call.rb.log +1 -0
  13. data/examples/call/call_monitor.rb +55 -0
  14. data/examples/daemonize/daemonize.rb +20 -0
  15. data/examples/run/ctrl_crash.rb +17 -0
  16. data/examples/run/ctrl_exec.rb +16 -0
  17. data/examples/run/ctrl_exit.rb +15 -0
  18. data/examples/run/ctrl_keep_pid_files.rb +17 -0
  19. data/examples/run/ctrl_monitor.rb +16 -0
  20. data/examples/run/ctrl_multiple.rb +16 -0
  21. data/examples/run/ctrl_normal.rb +12 -0
  22. data/examples/run/ctrl_ontop.rb +16 -0
  23. data/examples/run/ctrl_optionparser.rb +43 -0
  24. data/examples/run/ctrl_proc.rb +25 -0
  25. data/examples/run/ctrl_proc.rb.output +101 -0
  26. data/examples/run/ctrl_proc_multiple.rb +22 -0
  27. data/examples/run/ctrl_proc_multiple.rb.output +2 -0
  28. data/examples/run/ctrl_proc_simple.rb +17 -0
  29. data/examples/run/myserver.rb +12 -0
  30. data/examples/run/myserver_crashing.rb +14 -0
  31. data/examples/run/myserver_crashing.rb.output +30 -0
  32. data/examples/run/myserver_exiting.rb +8 -0
  33. data/html/classes/Daemonize.html +497 -0
  34. data/html/classes/Daemons.html +683 -0
  35. data/html/classes/Daemons/Application.html +836 -0
  36. data/html/classes/Daemons/ApplicationGroup.html +508 -0
  37. data/html/classes/Daemons/CmdException.html +113 -0
  38. data/html/classes/Daemons/Controller.html +429 -0
  39. data/html/classes/Daemons/Error.html +113 -0
  40. data/html/classes/Daemons/Exception.html +111 -0
  41. data/html/classes/Daemons/Monitor.html +263 -0
  42. data/html/classes/Daemons/Optparse.html +244 -0
  43. data/html/classes/Daemons/Pid.html +339 -0
  44. data/html/classes/Daemons/PidFile.html +441 -0
  45. data/html/classes/Daemons/PidMem.html +126 -0
  46. data/html/classes/Daemons/RuntimeException.html +113 -0
  47. data/html/classes/Daemons/SystemError.html +163 -0
  48. data/html/created.rid +1 -0
  49. data/html/files/README.html +377 -0
  50. data/html/files/Releases.html +342 -0
  51. data/html/files/TODO.html +121 -0
  52. data/html/files/lib/daemons/application_group_rb.html +101 -0
  53. data/html/files/lib/daemons/application_rb.html +110 -0
  54. data/html/files/lib/daemons/cmdline_rb.html +101 -0
  55. data/html/files/lib/daemons/controller_rb.html +101 -0
  56. data/html/files/lib/daemons/daemonize_rb.html +207 -0
  57. data/html/files/lib/daemons/exceptions_rb.html +101 -0
  58. data/html/files/lib/daemons/monitor_rb.html +108 -0
  59. data/html/files/lib/daemons/pid_rb.html +108 -0
  60. data/html/files/lib/daemons/pidfile_rb.html +108 -0
  61. data/html/files/lib/daemons/pidmem_rb.html +108 -0
  62. data/html/files/lib/daemons_rb.html +117 -0
  63. data/html/fr_class_index.html +41 -0
  64. data/html/fr_file_index.html +40 -0
  65. data/html/fr_method_index.html +91 -0
  66. data/html/index.html +24 -0
  67. data/html/rdoc-style.css +208 -0
  68. data/lib/daemons.rb +284 -0
  69. data/lib/daemons/application.rb +376 -0
  70. data/lib/daemons/application_group.rb +152 -0
  71. data/lib/daemons/cmdline.rb +117 -0
  72. data/lib/daemons/controller.rb +137 -0
  73. data/lib/daemons/daemonize.rb +263 -0
  74. data/lib/daemons/exceptions.rb +28 -0
  75. data/lib/daemons/monitor.rb +136 -0
  76. data/lib/daemons/pid.rb +115 -0
  77. data/lib/daemons/pidfile.rb +111 -0
  78. data/lib/daemons/pidmem.rb +10 -0
  79. data/lib/daemons/version.rb +3 -0
  80. data/setup.rb +1360 -0
  81. data/test/call_as_daemon.rb +12 -0
  82. data/test/tc_main.rb +24 -0
  83. data/test/test1.rb +19 -0
  84. data/test/testapp.rb +11 -0
  85. metadata +170 -0
@@ -0,0 +1,508 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Daemons::ApplicationGroup</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Daemons::ApplicationGroup</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/daemons/application_group_rb.html">
59
+ lib/daemons/application_group.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000056">create_monitor</a>&nbsp;&nbsp;
90
+ <a href="#M000054">find_applications</a>&nbsp;&nbsp;
91
+ <a href="#M000051">new</a>&nbsp;&nbsp;
92
+ <a href="#M000055">new_application</a>&nbsp;&nbsp;
93
+ <a href="#M000053">pidfile_dir</a>&nbsp;&nbsp;
94
+ <a href="#M000052">setup</a>&nbsp;&nbsp;
95
+ <a href="#M000060">show_status</a>&nbsp;&nbsp;
96
+ <a href="#M000057">start_all</a>&nbsp;&nbsp;
97
+ <a href="#M000058">stop_all</a>&nbsp;&nbsp;
98
+ <a href="#M000059">zap_all</a>&nbsp;&nbsp;
99
+ </div>
100
+ </div>
101
+
102
+ </div>
103
+
104
+
105
+ <!-- if includes -->
106
+
107
+ <div id="section">
108
+
109
+
110
+
111
+
112
+
113
+ <div id="attribute-list">
114
+ <h3 class="section-bar">Attributes</h3>
115
+
116
+ <div class="name-list">
117
+ <table>
118
+ <tr class="top-aligned-row context-row">
119
+ <td class="context-item-name">app_argv</td>
120
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
121
+ <td class="context-item-desc"></td>
122
+ </tr>
123
+ <tr class="top-aligned-row context-row">
124
+ <td class="context-item-name">app_name</td>
125
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
126
+ <td class="context-item-desc"></td>
127
+ </tr>
128
+ <tr class="top-aligned-row context-row">
129
+ <td class="context-item-name">applications</td>
130
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
131
+ <td class="context-item-desc"></td>
132
+ </tr>
133
+ <tr class="top-aligned-row context-row">
134
+ <td class="context-item-name">controller_argv</td>
135
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
136
+ <td class="context-item-desc"></td>
137
+ </tr>
138
+ <tr class="top-aligned-row context-row">
139
+ <td class="context-item-name">dir</td>
140
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
141
+ <td class="context-item-desc"></td>
142
+ </tr>
143
+ <tr class="top-aligned-row context-row">
144
+ <td class="context-item-name">dir_mode</td>
145
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
146
+ <td class="context-item-desc"></td>
147
+ </tr>
148
+ <tr class="top-aligned-row context-row">
149
+ <td class="context-item-name">monitor</td>
150
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
151
+ <td class="context-item-desc"></td>
152
+ </tr>
153
+ <tr class="top-aligned-row context-row">
154
+ <td class="context-item-name">multiple</td>
155
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
156
+ <td class="context-item-desc">
157
+ true if the application is supposed to run in multiple instances
158
+
159
+ </td>
160
+ </tr>
161
+ <tr class="top-aligned-row context-row">
162
+ <td class="context-item-name">options</td>
163
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
164
+ <td class="context-item-desc">
165
+ attr_reader :controller
166
+
167
+ </td>
168
+ </tr>
169
+ <tr class="top-aligned-row context-row">
170
+ <td class="context-item-name">script</td>
171
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
172
+ <td class="context-item-desc"></td>
173
+ </tr>
174
+ </table>
175
+ </div>
176
+ </div>
177
+
178
+
179
+
180
+ <!-- if method_list -->
181
+ <div id="methods">
182
+ <h3 class="section-bar">Public Class methods</h3>
183
+
184
+ <div id="method-M000051" class="method-detail">
185
+ <a name="M000051"></a>
186
+
187
+ <div class="method-heading">
188
+ <a href="#M000051" class="method-signature">
189
+ <span class="method-name">new</span><span class="method-args">(app_name, options = {})</span>
190
+ </a>
191
+ </div>
192
+
193
+ <div class="method-description">
194
+ <p><a class="source-toggle" href="#"
195
+ onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
196
+ <div class="method-source-code" id="M000051-source">
197
+ <pre>
198
+ <span class="ruby-comment cmt"># File lib/daemons/application_group.rb, line 26</span>
199
+ 26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app_name</span>, <span class="ruby-identifier">options</span> = {})
200
+ 27: <span class="ruby-ivar">@app_name</span> = <span class="ruby-identifier">app_name</span>
201
+ 28: <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
202
+ 29:
203
+ 30: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:script</span>]
204
+ 31: <span class="ruby-ivar">@script</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:script</span>])
205
+ 32: <span class="ruby-keyword kw">end</span>
206
+ 33:
207
+ 34: <span class="ruby-comment cmt">#@controller = controller</span>
208
+ 35: <span class="ruby-ivar">@monitor</span> = <span class="ruby-keyword kw">nil</span>
209
+ 36:
210
+ 37: <span class="ruby-comment cmt">#options = controller.options</span>
211
+ 38:
212
+ 39: <span class="ruby-ivar">@multiple</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:multiple</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">false</span>
213
+ 40:
214
+ 41: <span class="ruby-ivar">@dir_mode</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:dir_mode</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:script</span>
215
+ 42: <span class="ruby-ivar">@dir</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:dir</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>
216
+ 43:
217
+ 44: <span class="ruby-ivar">@keep_pid_files</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:keep_pid_files</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">false</span>
218
+ 45:
219
+ 46: <span class="ruby-comment cmt">#@applications = find_applications(pidfile_dir())</span>
220
+ 47: <span class="ruby-ivar">@applications</span> = []
221
+ 48: <span class="ruby-keyword kw">end</span>
222
+ </pre>
223
+ </div>
224
+ </div>
225
+ </div>
226
+
227
+ <h3 class="section-bar">Public Instance methods</h3>
228
+
229
+ <div id="method-M000056" class="method-detail">
230
+ <a name="M000056"></a>
231
+
232
+ <div class="method-heading">
233
+ <a href="#M000056" class="method-signature">
234
+ <span class="method-name">create_monitor</span><span class="method-args">(an_app)</span>
235
+ </a>
236
+ </div>
237
+
238
+ <div class="method-description">
239
+ <p><a class="source-toggle" href="#"
240
+ onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
241
+ <div class="method-source-code" id="M000056-source">
242
+ <pre>
243
+ <span class="ruby-comment cmt"># File lib/daemons/application_group.rb, line 107</span>
244
+ 107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_monitor</span>(<span class="ruby-identifier">an_app</span>)
245
+ 108: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@monitor</span>
246
+ 109:
247
+ 110: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:monitor</span>]
248
+ 111: <span class="ruby-ivar">@monitor</span> = <span class="ruby-constant">Monitor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">an_app</span>)
249
+ 112:
250
+ 113: <span class="ruby-ivar">@monitor</span>.<span class="ruby-identifier">start</span>(<span class="ruby-ivar">@applications</span>)
251
+ 114: <span class="ruby-keyword kw">end</span>
252
+ 115: <span class="ruby-keyword kw">end</span>
253
+ </pre>
254
+ </div>
255
+ </div>
256
+ </div>
257
+
258
+ <div id="method-M000054" class="method-detail">
259
+ <a name="M000054"></a>
260
+
261
+ <div class="method-heading">
262
+ <a href="#M000054" class="method-signature">
263
+ <span class="method-name">find_applications</span><span class="method-args">(dir)</span>
264
+ </a>
265
+ </div>
266
+
267
+ <div class="method-description">
268
+ <p><a class="source-toggle" href="#"
269
+ onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
270
+ <div class="method-source-code" id="M000054-source">
271
+ <pre>
272
+ <span class="ruby-comment cmt"># File lib/daemons/application_group.rb, line 62</span>
273
+ 62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_applications</span>(<span class="ruby-identifier">dir</span>)
274
+ 63: <span class="ruby-identifier">pid_files</span> = <span class="ruby-constant">PidFile</span>.<span class="ruby-identifier">find_files</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">app_name</span>, <span class="ruby-operator">!</span> <span class="ruby-ivar">@keep_pid_files</span>)
275
+ 64:
276
+ 65: <span class="ruby-comment cmt">#pp pid_files</span>
277
+ 66:
278
+ 67: <span class="ruby-ivar">@monitor</span> = <span class="ruby-constant">Monitor</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">app_name</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'_monitor'</span>)
279
+ 68:
280
+ 69: <span class="ruby-identifier">pid_files</span>.<span class="ruby-identifier">reject!</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/_monitor.pid$/</span>}
281
+ 70:
282
+ 71: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pid_files</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
283
+ 72: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Application</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, {}, <span class="ruby-constant">PidFile</span>.<span class="ruby-identifier">existing</span>(<span class="ruby-identifier">f</span>))
284
+ 73: <span class="ruby-identifier">setup_app</span>(<span class="ruby-identifier">app</span>)
285
+ 74: <span class="ruby-identifier">app</span>
286
+ 75: }
287
+ 76: <span class="ruby-keyword kw">end</span>
288
+ </pre>
289
+ </div>
290
+ </div>
291
+ </div>
292
+
293
+ <div id="method-M000055" class="method-detail">
294
+ <a name="M000055"></a>
295
+
296
+ <div class="method-heading">
297
+ <a href="#M000055" class="method-signature">
298
+ <span class="method-name">new_application</span><span class="method-args">(add_options = {})</span>
299
+ </a>
300
+ </div>
301
+
302
+ <div class="method-description">
303
+ <p><a class="source-toggle" href="#"
304
+ onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
305
+ <div class="method-source-code" id="M000055-source">
306
+ <pre>
307
+ <span class="ruby-comment cmt"># File lib/daemons/application_group.rb, line 78</span>
308
+ 78: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_application</span>(<span class="ruby-identifier">add_options</span> = {})
309
+ 79: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@applications</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@multiple</span>
310
+ 80: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:force</span>]
311
+ 81: <span class="ruby-ivar">@applications</span>.<span class="ruby-identifier">delete_if</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
312
+ 82: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">running?</span>
313
+ 83: <span class="ruby-identifier">a</span>.<span class="ruby-identifier">zap</span>
314
+ 84: <span class="ruby-keyword kw">true</span>
315
+ 85: <span class="ruby-keyword kw">end</span>
316
+ 86: }
317
+ 87: <span class="ruby-keyword kw">end</span>
318
+ 88:
319
+ 89: <span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'there is already one or more instance(s) of the program running'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@applications</span>.<span class="ruby-identifier">empty?</span>
320
+ 90: <span class="ruby-keyword kw">end</span>
321
+ 91:
322
+ 92: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Application</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">add_options</span>)
323
+ 93:
324
+ 94: <span class="ruby-identifier">setup_app</span>(<span class="ruby-identifier">app</span>)
325
+ 95:
326
+ 96: <span class="ruby-ivar">@applications</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">app</span>
327
+ 97:
328
+ 98: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">app</span>
329
+ 99: <span class="ruby-keyword kw">end</span>
330
+ </pre>
331
+ </div>
332
+ </div>
333
+ </div>
334
+
335
+ <div id="method-M000053" class="method-detail">
336
+ <a name="M000053"></a>
337
+
338
+ <div class="method-heading">
339
+ <a href="#M000053" class="method-signature">
340
+ <span class="method-name">pidfile_dir</span><span class="method-args">()</span>
341
+ </a>
342
+ </div>
343
+
344
+ <div class="method-description">
345
+ <p><a class="source-toggle" href="#"
346
+ onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
347
+ <div class="method-source-code" id="M000053-source">
348
+ <pre>
349
+ <span class="ruby-comment cmt"># File lib/daemons/application_group.rb, line 58</span>
350
+ 58: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pidfile_dir</span>
351
+ 59: <span class="ruby-constant">PidFile</span>.<span class="ruby-identifier">dir</span>(<span class="ruby-ivar">@dir_mode</span>, <span class="ruby-ivar">@dir</span>, <span class="ruby-identifier">script</span>)
352
+ 60: <span class="ruby-keyword kw">end</span>
353
+ </pre>
354
+ </div>
355
+ </div>
356
+ </div>
357
+
358
+ <div id="method-M000052" class="method-detail">
359
+ <a name="M000052"></a>
360
+
361
+ <div class="method-heading">
362
+ <a href="#M000052" class="method-signature">
363
+ <span class="method-name">setup</span><span class="method-args">()</span>
364
+ </a>
365
+ </div>
366
+
367
+ <div class="method-description">
368
+ <p>
369
+ Setup the application group. Currently this functions calls <tt><a
370
+ href="ApplicationGroup.html#M000054">find_applications</a></tt> which finds
371
+ all running instances of the application and populates the application
372
+ array.
373
+ </p>
374
+ <p><a class="source-toggle" href="#"
375
+ onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
376
+ <div class="method-source-code" id="M000052-source">
377
+ <pre>
378
+ <span class="ruby-comment cmt"># File lib/daemons/application_group.rb, line 54</span>
379
+ 54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
380
+ 55: <span class="ruby-ivar">@applications</span> = <span class="ruby-identifier">find_applications</span>(<span class="ruby-identifier">pidfile_dir</span>())
381
+ 56: <span class="ruby-keyword kw">end</span>
382
+ </pre>
383
+ </div>
384
+ </div>
385
+ </div>
386
+
387
+ <div id="method-M000060" class="method-detail">
388
+ <a name="M000060"></a>
389
+
390
+ <div class="method-heading">
391
+ <a href="#M000060" class="method-signature">
392
+ <span class="method-name">show_status</span><span class="method-args">()</span>
393
+ </a>
394
+ </div>
395
+
396
+ <div class="method-description">
397
+ <p><a class="source-toggle" href="#"
398
+ onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
399
+ <div class="method-source-code" id="M000060-source">
400
+ <pre>
401
+ <span class="ruby-comment cmt"># File lib/daemons/application_group.rb, line 146</span>
402
+ 146: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show_status</span>
403
+ 147: <span class="ruby-ivar">@applications</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">show_status</span>}
404
+ 148: <span class="ruby-keyword kw">end</span>
405
+ </pre>
406
+ </div>
407
+ </div>
408
+ </div>
409
+
410
+ <div id="method-M000057" class="method-detail">
411
+ <a name="M000057"></a>
412
+
413
+ <div class="method-heading">
414
+ <a href="#M000057" class="method-signature">
415
+ <span class="method-name">start_all</span><span class="method-args">()</span>
416
+ </a>
417
+ </div>
418
+
419
+ <div class="method-description">
420
+ <p><a class="source-toggle" href="#"
421
+ onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
422
+ <div class="method-source-code" id="M000057-source">
423
+ <pre>
424
+ <span class="ruby-comment cmt"># File lib/daemons/application_group.rb, line 117</span>
425
+ 117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_all</span>
426
+ 118: <span class="ruby-ivar">@monitor</span>.<span class="ruby-identifier">stop</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@monitor</span>
427
+ 119: <span class="ruby-ivar">@monitor</span> = <span class="ruby-keyword kw">nil</span>
428
+ 120:
429
+ 121: <span class="ruby-ivar">@applications</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
430
+ 122: <span class="ruby-identifier">fork</span> {
431
+ 123: <span class="ruby-identifier">a</span>.<span class="ruby-identifier">start</span>
432
+ 124: }
433
+ 125: }
434
+ 126: <span class="ruby-keyword kw">end</span>
435
+ </pre>
436
+ </div>
437
+ </div>
438
+ </div>
439
+
440
+ <div id="method-M000058" class="method-detail">
441
+ <a name="M000058"></a>
442
+
443
+ <div class="method-heading">
444
+ <a href="#M000058" class="method-signature">
445
+ <span class="method-name">stop_all</span><span class="method-args">(force = false)</span>
446
+ </a>
447
+ </div>
448
+
449
+ <div class="method-description">
450
+ <p><a class="source-toggle" href="#"
451
+ onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
452
+ <div class="method-source-code" id="M000058-source">
453
+ <pre>
454
+ <span class="ruby-comment cmt"># File lib/daemons/application_group.rb, line 128</span>
455
+ 128: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop_all</span>(<span class="ruby-identifier">force</span> = <span class="ruby-keyword kw">false</span>)
456
+ 129: <span class="ruby-ivar">@monitor</span>.<span class="ruby-identifier">stop</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@monitor</span>
457
+ 130:
458
+ 131: <span class="ruby-ivar">@applications</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
459
+ 132: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">force</span>
460
+ 133: <span class="ruby-keyword kw">begin</span>; <span class="ruby-identifier">a</span>.<span class="ruby-identifier">stop</span>; <span class="ruby-keyword kw">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Exception</span>; <span class="ruby-keyword kw">end</span>
461
+ 134: <span class="ruby-keyword kw">else</span>
462
+ 135: <span class="ruby-identifier">a</span>.<span class="ruby-identifier">stop</span>
463
+ 136: <span class="ruby-keyword kw">end</span>
464
+ 137: }
465
+ 138: <span class="ruby-keyword kw">end</span>
466
+ </pre>
467
+ </div>
468
+ </div>
469
+ </div>
470
+
471
+ <div id="method-M000059" class="method-detail">
472
+ <a name="M000059"></a>
473
+
474
+ <div class="method-heading">
475
+ <a href="#M000059" class="method-signature">
476
+ <span class="method-name">zap_all</span><span class="method-args">()</span>
477
+ </a>
478
+ </div>
479
+
480
+ <div class="method-description">
481
+ <p><a class="source-toggle" href="#"
482
+ onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
483
+ <div class="method-source-code" id="M000059-source">
484
+ <pre>
485
+ <span class="ruby-comment cmt"># File lib/daemons/application_group.rb, line 140</span>
486
+ 140: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">zap_all</span>
487
+ 141: <span class="ruby-ivar">@monitor</span>.<span class="ruby-identifier">stop</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@monitor</span>
488
+ 142:
489
+ 143: <span class="ruby-ivar">@applications</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">zap</span>}
490
+ 144: <span class="ruby-keyword kw">end</span>
491
+ </pre>
492
+ </div>
493
+ </div>
494
+ </div>
495
+
496
+
497
+ </div>
498
+
499
+
500
+ </div>
501
+
502
+
503
+ <div id="validator-badges">
504
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
505
+ </div>
506
+
507
+ </body>
508
+ </html>