mlanett-daemons 1.0.13

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.
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,244 @@
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::Optparse</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::Optparse</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/daemons/cmdline_rb.html">
59
+ lib/daemons/cmdline.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="#M000014">new</a>&nbsp;&nbsp;
90
+ <a href="#M000015">parse</a>&nbsp;&nbsp;
91
+ </div>
92
+ </div>
93
+
94
+ </div>
95
+
96
+
97
+ <!-- if includes -->
98
+
99
+ <div id="section">
100
+
101
+
102
+
103
+
104
+
105
+ <div id="attribute-list">
106
+ <h3 class="section-bar">Attributes</h3>
107
+
108
+ <div class="name-list">
109
+ <table>
110
+ <tr class="top-aligned-row context-row">
111
+ <td class="context-item-name">usage</td>
112
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
113
+ <td class="context-item-desc"></td>
114
+ </tr>
115
+ </table>
116
+ </div>
117
+ </div>
118
+
119
+
120
+
121
+ <!-- if method_list -->
122
+ <div id="methods">
123
+ <h3 class="section-bar">Public Class methods</h3>
124
+
125
+ <div id="method-M000014" class="method-detail">
126
+ <a name="M000014"></a>
127
+
128
+ <div class="method-heading">
129
+ <a href="#M000014" class="method-signature">
130
+ <span class="method-name">new</span><span class="method-args">(controller)</span>
131
+ </a>
132
+ </div>
133
+
134
+ <div class="method-description">
135
+ <p><a class="source-toggle" href="#"
136
+ onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
137
+ <div class="method-source-code" id="M000014-source">
138
+ <pre>
139
+ <span class="ruby-comment cmt"># File lib/daemons/cmdline.rb, line 8</span>
140
+ 8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">controller</span>)
141
+ 9: <span class="ruby-ivar">@controller</span> = <span class="ruby-identifier">controller</span>
142
+ 10: <span class="ruby-ivar">@options</span> = {}
143
+ 11:
144
+ 12: <span class="ruby-ivar">@opts</span> = <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opts</span><span class="ruby-operator">|</span>
145
+ 13: <span class="ruby-comment cmt">#opts.banner = &quot;Usage: example.rb [options]&quot;</span>
146
+ 14: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-value str">&quot;&quot;</span>
147
+ 15:
148
+ 16: <span class="ruby-comment cmt"># Boolean switch.</span>
149
+ 17: <span class="ruby-comment cmt"># opts.on(&quot;-v&quot;, &quot;--[no-]verbose&quot;, &quot;Run verbosely&quot;) do |v|</span>
150
+ 18: <span class="ruby-comment cmt"># @options[:verbose] = v</span>
151
+ 19: <span class="ruby-comment cmt"># end</span>
152
+ 20:
153
+ 21: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-t&quot;</span>, <span class="ruby-value str">&quot;--ontop&quot;</span>, <span class="ruby-value str">&quot;Stay on top (does not daemonize)&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
154
+ 22: <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:ontop</span>] = <span class="ruby-identifier">t</span>
155
+ 23: <span class="ruby-keyword kw">end</span>
156
+ 24:
157
+ 25: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-f&quot;</span>, <span class="ruby-value str">&quot;--force&quot;</span>, <span class="ruby-value str">&quot;Force operation&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
158
+ 26: <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:force</span>] = <span class="ruby-identifier">t</span>
159
+ 27: <span class="ruby-keyword kw">end</span>
160
+ 28:
161
+ 29: <span class="ruby-comment cmt">#opts.separator &quot;&quot;</span>
162
+ 30: <span class="ruby-comment cmt">#opts.separator &quot;Specific options:&quot;</span>
163
+ 31:
164
+ 32:
165
+ 33: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;&quot;</span>
166
+ 34: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;Common options:&quot;</span>
167
+ 35:
168
+ 36: <span class="ruby-comment cmt"># No argument, shows at tail. This will print an options summary.</span>
169
+ 37: <span class="ruby-comment cmt"># Try it and see!</span>
170
+ 38: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on_tail</span>(<span class="ruby-value str">&quot;-h&quot;</span>, <span class="ruby-value str">&quot;--help&quot;</span>, <span class="ruby-value str">&quot;Show this message&quot;</span>) <span class="ruby-keyword kw">do</span>
171
+ 39: <span class="ruby-comment cmt">#puts opts</span>
172
+ 40: <span class="ruby-comment cmt">#@usage = </span>
173
+ 41: <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">print_usage</span>()
174
+ 42:
175
+ 43: <span class="ruby-identifier">exit</span>
176
+ 44: <span class="ruby-keyword kw">end</span>
177
+ 45:
178
+ 46: <span class="ruby-comment cmt"># Another typical switch to print the version.</span>
179
+ 47: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on_tail</span>(<span class="ruby-value str">&quot;--version&quot;</span>, <span class="ruby-value str">&quot;Show version&quot;</span>) <span class="ruby-keyword kw">do</span>
180
+ 48: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;daemons version #{Daemons::VERSION}&quot;</span>
181
+ 49: <span class="ruby-identifier">exit</span>
182
+ 50: <span class="ruby-keyword kw">end</span>
183
+ 51: <span class="ruby-keyword kw">end</span>
184
+ 52:
185
+ 53: <span class="ruby-keyword kw">begin</span>
186
+ 54: <span class="ruby-ivar">@usage</span> = <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">to_s</span>
187
+ 55: <span class="ruby-keyword kw">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Exception</span> <span class="ruby-comment cmt"># work around a bug in ruby 1.9</span>
188
+ 56: <span class="ruby-ivar">@usage</span> = <span class="ruby-value str">&quot; -t, --ontop Stay on top (does not daemonize)\n -f, --force Force operation\n\n Common options:\n -h, --help Show this message\n --version Show version\n&quot;</span>
189
+ 57: <span class="ruby-keyword kw">end</span>
190
+ 58: <span class="ruby-keyword kw">end</span>
191
+ </pre>
192
+ </div>
193
+ </div>
194
+ </div>
195
+
196
+ <h3 class="section-bar">Public Instance methods</h3>
197
+
198
+ <div id="method-M000015" class="method-detail">
199
+ <a name="M000015"></a>
200
+
201
+ <div class="method-heading">
202
+ <a href="#M000015" class="method-signature">
203
+ <span class="method-name">parse</span><span class="method-args">(args)</span>
204
+ </a>
205
+ </div>
206
+
207
+ <div class="method-description">
208
+ <p>
209
+ Return a hash describing the options.
210
+ </p>
211
+ <p><a class="source-toggle" href="#"
212
+ onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
213
+ <div class="method-source-code" id="M000015-source">
214
+ <pre>
215
+ <span class="ruby-comment cmt"># File lib/daemons/cmdline.rb, line 72</span>
216
+ 72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">args</span>)
217
+ 73: <span class="ruby-comment cmt"># The options specified on the command line will be collected in *options*.</span>
218
+ 74: <span class="ruby-comment cmt"># We set default values here.</span>
219
+ 75: <span class="ruby-comment cmt">#options = {}</span>
220
+ 76:
221
+ 77:
222
+ 78: <span class="ruby-comment cmt">##pp args</span>
223
+ 79: <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">args</span>)
224
+ 80:
225
+ 81: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@options</span>
226
+ 82: <span class="ruby-keyword kw">end</span>
227
+ </pre>
228
+ </div>
229
+ </div>
230
+ </div>
231
+
232
+
233
+ </div>
234
+
235
+
236
+ </div>
237
+
238
+
239
+ <div id="validator-badges">
240
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
241
+ </div>
242
+
243
+ </body>
244
+ </html>
@@ -0,0 +1,339 @@
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::Pid</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::Pid</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/daemons/pid_rb.html">
59
+ lib/daemons/pid.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="#M000012">cleanup</a>&nbsp;&nbsp;
90
+ <a href="#M000008">dir</a>&nbsp;&nbsp;
91
+ <a href="#M000013">exist?</a>&nbsp;&nbsp;
92
+ <a href="#M000009">new</a>&nbsp;&nbsp;
93
+ <a href="#M000010">pid</a>&nbsp;&nbsp;
94
+ <a href="#M000011">pid=</a>&nbsp;&nbsp;
95
+ <a href="#M000007">running?</a>&nbsp;&nbsp;
96
+ </div>
97
+ </div>
98
+
99
+ </div>
100
+
101
+
102
+ <!-- if includes -->
103
+
104
+ <div id="section">
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+ <!-- if method_list -->
114
+ <div id="methods">
115
+ <h3 class="section-bar">Public Class methods</h3>
116
+
117
+ <div id="method-M000008" class="method-detail">
118
+ <a name="M000008"></a>
119
+
120
+ <div class="method-heading">
121
+ <a href="#M000008" class="method-signature">
122
+ <span class="method-name">dir</span><span class="method-args">(dir_mode, dir, script)</span>
123
+ </a>
124
+ </div>
125
+
126
+ <div class="method-description">
127
+ <p>
128
+ Returns the directory that should be used to write the <a
129
+ href="Pid.html#M000010">pid</a> file to depending on the given mode.
130
+ </p>
131
+ <p>
132
+ Some modes may require an additionaly hint, others may determine the
133
+ directory automatically.
134
+ </p>
135
+ <p>
136
+ If no valid directory is found, returns nil.
137
+ </p>
138
+ <p><a class="source-toggle" href="#"
139
+ onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
140
+ <div class="method-source-code" id="M000008-source">
141
+ <pre>
142
+ <span class="ruby-comment cmt"># File lib/daemons/pid.rb, line 60</span>
143
+ 60: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Pid</span>.<span class="ruby-identifier">dir</span>(<span class="ruby-identifier">dir_mode</span>, <span class="ruby-identifier">dir</span>, <span class="ruby-identifier">script</span>)
144
+ 61: <span class="ruby-comment cmt"># nil script parameter is allowed as long as dir_mode is not :script</span>
145
+ 62: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dir_mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:script</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">script</span>.<span class="ruby-identifier">nil?</span>
146
+ 63:
147
+ 64: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">dir_mode</span>
148
+ 65: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:normal</span>
149
+ 66: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">dir</span>)
150
+ 67: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:script</span>
151
+ 68: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">script</span>),<span class="ruby-identifier">dir</span>))
152
+ 69: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:system</span>
153
+ 70: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'/var/run'</span>
154
+ 71: <span class="ruby-keyword kw">else</span>
155
+ 72: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Error</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;pid file mode '#{dir_mode}' not implemented&quot;</span>)
156
+ 73: <span class="ruby-keyword kw">end</span>
157
+ 74: <span class="ruby-keyword kw">end</span>
158
+ </pre>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <div id="method-M000009" class="method-detail">
164
+ <a name="M000009"></a>
165
+
166
+ <div class="method-heading">
167
+ <a href="#M000009" class="method-signature">
168
+ <span class="method-name">new</span><span class="method-args">()</span>
169
+ </a>
170
+ </div>
171
+
172
+ <div class="method-description">
173
+ <p>
174
+ Initialization method
175
+ </p>
176
+ <p><a class="source-toggle" href="#"
177
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
178
+ <div class="method-source-code" id="M000009-source">
179
+ <pre>
180
+ <span class="ruby-comment cmt"># File lib/daemons/pid.rb, line 77</span>
181
+ 77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
182
+ 78: <span class="ruby-keyword kw">end</span>
183
+ </pre>
184
+ </div>
185
+ </div>
186
+ </div>
187
+
188
+ <div id="method-M000007" class="method-detail">
189
+ <a name="M000007"></a>
190
+
191
+ <div class="method-heading">
192
+ <a href="#M000007" class="method-signature">
193
+ <span class="method-name">running?</span><span class="method-args">(pid)</span>
194
+ </a>
195
+ </div>
196
+
197
+ <div class="method-description">
198
+ <p><a class="source-toggle" href="#"
199
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
200
+ <div class="method-source-code" id="M000007-source">
201
+ <pre>
202
+ <span class="ruby-comment cmt"># File lib/daemons/pid.rb, line 8</span>
203
+ 8: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Pid</span>.<span class="ruby-identifier">running?</span>(<span class="ruby-identifier">pid</span>)
204
+ 9: <span class="ruby-comment cmt"># Check if process is in existence</span>
205
+ 10: <span class="ruby-comment cmt"># The simplest way to do this is to send signal '0'</span>
206
+ 11: <span class="ruby-comment cmt"># (which is a single system call) that doesn't actually</span>
207
+ 12: <span class="ruby-comment cmt"># send a signal</span>
208
+ 13: <span class="ruby-keyword kw">begin</span>
209
+ 14: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">kill</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">pid</span>)
210
+ 15: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
211
+ 16: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ESRCH</span>
212
+ 17: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
213
+ 18: <span class="ruby-keyword kw">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Exception</span> <span class="ruby-comment cmt"># for example on EPERM (process exists but does not belong to us)</span>
214
+ 19: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
215
+ 20: <span class="ruby-comment cmt">#rescue Errno::EPERM</span>
216
+ 21: <span class="ruby-comment cmt"># return false</span>
217
+ 22: <span class="ruby-keyword kw">end</span>
218
+ 23: <span class="ruby-keyword kw">end</span>
219
+ </pre>
220
+ </div>
221
+ </div>
222
+ </div>
223
+
224
+ <h3 class="section-bar">Public Instance methods</h3>
225
+
226
+ <div id="method-M000012" class="method-detail">
227
+ <a name="M000012"></a>
228
+
229
+ <div class="method-heading">
230
+ <a href="#M000012" class="method-signature">
231
+ <span class="method-name">cleanup</span><span class="method-args">()</span>
232
+ </a>
233
+ </div>
234
+
235
+ <div class="method-description">
236
+ <p>
237
+ Cleanup method
238
+ </p>
239
+ <p><a class="source-toggle" href="#"
240
+ onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
241
+ <div class="method-source-code" id="M000012-source">
242
+ <pre>
243
+ <span class="ruby-comment cmt"># File lib/daemons/pid.rb, line 90</span>
244
+ 90: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup</span>
245
+ 91: <span class="ruby-keyword kw">end</span>
246
+ </pre>
247
+ </div>
248
+ </div>
249
+ </div>
250
+
251
+ <div id="method-M000013" class="method-detail">
252
+ <a name="M000013"></a>
253
+
254
+ <div class="method-heading">
255
+ <a href="#M000013" class="method-signature">
256
+ <span class="method-name">exist?</span><span class="method-args">()</span>
257
+ </a>
258
+ </div>
259
+
260
+ <div class="method-description">
261
+ <p>
262
+ Exists? method
263
+ </p>
264
+ <p><a class="source-toggle" href="#"
265
+ onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
266
+ <div class="method-source-code" id="M000013-source">
267
+ <pre>
268
+ <span class="ruby-comment cmt"># File lib/daemons/pid.rb, line 94</span>
269
+ 94: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exist?</span>
270
+ 95: <span class="ruby-keyword kw">true</span>
271
+ 96: <span class="ruby-keyword kw">end</span>
272
+ </pre>
273
+ </div>
274
+ </div>
275
+ </div>
276
+
277
+ <div id="method-M000010" class="method-detail">
278
+ <a name="M000010"></a>
279
+
280
+ <div class="method-heading">
281
+ <a href="#M000010" class="method-signature">
282
+ <span class="method-name">pid</span><span class="method-args">()</span>
283
+ </a>
284
+ </div>
285
+
286
+ <div class="method-description">
287
+ <p>
288
+ Get method
289
+ </p>
290
+ <p><a class="source-toggle" href="#"
291
+ onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
292
+ <div class="method-source-code" id="M000010-source">
293
+ <pre>
294
+ <span class="ruby-comment cmt"># File lib/daemons/pid.rb, line 82</span>
295
+ 82: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pid</span>
296
+ 83: <span class="ruby-keyword kw">end</span>
297
+ </pre>
298
+ </div>
299
+ </div>
300
+ </div>
301
+
302
+ <div id="method-M000011" class="method-detail">
303
+ <a name="M000011"></a>
304
+
305
+ <div class="method-heading">
306
+ <a href="#M000011" class="method-signature">
307
+ <span class="method-name">pid=</span><span class="method-args">(p)</span>
308
+ </a>
309
+ </div>
310
+
311
+ <div class="method-description">
312
+ <p>
313
+ Set method
314
+ </p>
315
+ <p><a class="source-toggle" href="#"
316
+ onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
317
+ <div class="method-source-code" id="M000011-source">
318
+ <pre>
319
+ <span class="ruby-comment cmt"># File lib/daemons/pid.rb, line 86</span>
320
+ 86: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pid=</span>(<span class="ruby-identifier">p</span>)
321
+ 87: <span class="ruby-keyword kw">end</span>
322
+ </pre>
323
+ </div>
324
+ </div>
325
+ </div>
326
+
327
+
328
+ </div>
329
+
330
+
331
+ </div>
332
+
333
+
334
+ <div id="validator-badges">
335
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
336
+ </div>
337
+
338
+ </body>
339
+ </html>