rbatch 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.ja.md +14 -5
- data/README.md +164 -154
- data/bin/rbatch-init +21 -13
- data/doc/RBatch/Cmd.html +300 -316
- data/doc/RBatch/CmdException.html +146 -141
- data/doc/RBatch/CmdResult.html +467 -470
- data/doc/RBatch/Config.html +392 -433
- data/doc/RBatch/Controller.html +374 -0
- data/doc/RBatch/DoubleRunCheckException.html +146 -141
- data/doc/RBatch/DoubleRunChecker.html +258 -256
- data/doc/RBatch/Journal.html +332 -0
- data/doc/RBatch/Log.html +636 -805
- data/doc/RBatch/LogException.html +164 -0
- data/doc/RBatch/RBatch/RBatch/ConfigException.html +164 -0
- data/doc/RBatch/RBatch/RBatch.html +163 -0
- data/doc/RBatch/RBatch/VariablesException.html +164 -0
- data/doc/RBatch/RBatch.html +165 -0
- data/doc/RBatch/RunConf/Exception.html +146 -141
- data/doc/RBatch/RunConf.html +478 -532
- data/doc/RBatch/Variables.html +437 -0
- data/doc/RBatch.html +388 -862
- data/doc/created.rid +11 -9
- data/doc/index.html +178 -184
- data/doc/js/darkfish.js +9 -7
- data/doc/lib/rbatch/cmd_rb.html +46 -44
- data/doc/lib/rbatch/config_rb.html +42 -42
- data/doc/lib/rbatch/controller_rb.html +66 -0
- data/doc/lib/rbatch/double_run_checker_rb.html +42 -42
- data/doc/lib/rbatch/journal_rb.html +52 -0
- data/doc/lib/rbatch/log_rb.html +46 -46
- data/doc/lib/rbatch/run_conf_rb.html +42 -42
- data/doc/lib/rbatch/variables_rb.html +54 -0
- data/doc/lib/rbatch/version_rb.html +38 -38
- data/doc/lib/rbatch_rb.html +40 -52
- data/doc/rdoc.css +365 -308
- data/lib/rbatch/cmd.rb +15 -58
- data/lib/rbatch/config.rb +7 -7
- data/lib/rbatch/controller.rb +37 -61
- data/lib/rbatch/double_run_checker.rb +0 -0
- data/lib/rbatch/journal.rb +40 -0
- data/lib/rbatch/log.rb +71 -129
- data/lib/rbatch/run_conf.rb +13 -24
- data/lib/rbatch/variables.rb +82 -0
- data/lib/rbatch/version.rb +1 -1
- data/lib/rbatch.rb +7 -36
- data/sample/.rbatchrc +41 -7
- data/spec/01_rbach_spec.rb +99 -0
- data/spec/{cmd_spec.rb → rbatch/cmd_spec.rb} +40 -43
- data/spec/rbatch/config_spec.rb +67 -0
- data/spec/rbatch/controller_spec.rb +18 -0
- data/spec/{double_run_checker_spec.rb → rbatch/double_run_checker_spec.rb} +3 -0
- data/spec/rbatch/journal_spec.rb +29 -0
- data/spec/rbatch/log_spec.rb +350 -0
- data/spec/{run_conf_spec.rb → rbatch/run_conf_spec.rb} +13 -5
- data/spec/rbatch/variables_spec.rb +68 -0
- data/spec/spec_helper.rb +4 -5
- metadata +33 -17
- data/lib/rbatch/common_config.rb +0 -0
- data/spec/common_config_spec.rb +0 -85
- data/spec/config_spec.rb +0 -79
- data/spec/log_spec.rb +0 -430
- data/spec/rbatch_spec.rb +0 -22
data/README.ja.md
CHANGED
@@ -321,15 +321,24 @@ Run-Conf(`${RB_HOME}/.rbatchrc`)のサンプルは以下の通り
|
|
321
321
|
#log_mail_server_host : "localhost"
|
322
322
|
#log_mail_server_port : 25
|
323
323
|
|
324
|
-
# RBatch
|
324
|
+
# RBatchの実行ログ(Journal)のLevel
|
325
325
|
#
|
326
|
-
# デフォルトは
|
327
|
-
#
|
326
|
+
# デフォルトは1
|
327
|
+
# 大きい数を指定すると多くの実行ログが出力される。
|
328
|
+
# 0を指定すると何も表示されない。
|
328
329
|
# RBatchメッセージの例
|
329
330
|
# [RBatch] Load Config : "../conf/hoge.yaml"
|
330
331
|
#
|
331
|
-
#
|
332
|
-
#
|
332
|
+
#rbatch_journal_level = 2
|
333
|
+
#rbatch_journal_level = 0
|
334
|
+
|
335
|
+
# RBatchの実行ログをログに混ぜ込む
|
336
|
+
#
|
337
|
+
# デフォルトは true。
|
338
|
+
# trueを指定すると、RBatchメッセージをその時開かれているログに混ぜこむ。
|
339
|
+
#
|
340
|
+
#mix_rbatch_journal_to_logs : true
|
341
|
+
#mix_rbatch_journal_to_logs : false
|
333
342
|
|
334
343
|
```
|
335
344
|
|
data/README.md
CHANGED
@@ -171,160 +171,170 @@ When an option is set in both (1) and (2), (2) is prior to (1).
|
|
171
171
|
#### Customize by writing Run-Conf (.rbatchrc)
|
172
172
|
|
173
173
|
Sample of RBatch Run-Conf `${RB_HOME}/.rbatchrc`.
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
174
|
+
```
|
175
|
+
# RBatch Run-Conf (.rbatchrc)
|
176
|
+
#
|
177
|
+
# This format is YAML.
|
178
|
+
#
|
179
|
+
|
180
|
+
# -------------------
|
181
|
+
# Global setting
|
182
|
+
# -------------------
|
183
|
+
|
184
|
+
# Conf Directory
|
185
|
+
#
|
186
|
+
# Default is "<home>/conf"
|
187
|
+
# <home> is replaced to ${RB_HOME}
|
188
|
+
#
|
189
|
+
#conf_dir: <home>/config/
|
190
|
+
#conf_dir: /etc/rbatch/
|
191
|
+
|
192
|
+
# Common config file name
|
193
|
+
#
|
194
|
+
# Default is "common.yaml"
|
195
|
+
#
|
196
|
+
#common_conf_name: share.yaml
|
197
|
+
|
198
|
+
# Library Directory
|
199
|
+
#
|
200
|
+
# Default is "<home>/lib"
|
201
|
+
# <home> is replaced to ${RB_HOME}
|
202
|
+
#
|
203
|
+
#lib_dir: /usr/local/lib/rbatch/
|
204
|
+
|
205
|
+
# Auto Library Load
|
206
|
+
#
|
207
|
+
# Default is true
|
208
|
+
# If true, require "(library directory)/*.rb" before script run.
|
209
|
+
#
|
210
|
+
#auto_lib_load: true
|
211
|
+
#auto_lib_load: false
|
212
|
+
|
213
|
+
# Forbit Script Double Run
|
214
|
+
#
|
215
|
+
# Default is false.
|
216
|
+
# If true, two same name scripts cannot run at the same time.
|
217
|
+
#
|
218
|
+
#forbid_double_run: true
|
219
|
+
#forbid_double_run: false
|
220
|
+
|
221
|
+
# -------------------
|
222
|
+
# Cmd setting
|
223
|
+
# -------------------
|
224
|
+
|
225
|
+
# Raise Exception
|
226
|
+
#
|
227
|
+
# Default is false.
|
228
|
+
# If true, when command exit status is not 0, raise exception.
|
229
|
+
#
|
230
|
+
#cmd_raise : true
|
231
|
+
#cmd_raise : false
|
232
|
+
|
233
|
+
# Command Timeout
|
234
|
+
#
|
235
|
+
# Default is 0 [sec].
|
236
|
+
#
|
237
|
+
#cmd_timeout: 5
|
238
|
+
|
239
|
+
# -------------------
|
240
|
+
# Log setting
|
241
|
+
# -------------------
|
242
|
+
|
243
|
+
# Log Directory
|
244
|
+
#
|
245
|
+
# Default is "<home>/log"
|
246
|
+
# <home> is replaced to ${RB_HOME}
|
247
|
+
#
|
248
|
+
#log_dir: <home>/rb_log
|
249
|
+
#log_dir: /var/log/rbatch/
|
250
|
+
|
251
|
+
# Log File Name
|
252
|
+
#
|
253
|
+
# Default is "<date>_<time>_<prog>.log".
|
254
|
+
# <data> is replaced to YYYYMMDD date string
|
255
|
+
# <time> is replaced to HHMMSS time string
|
256
|
+
# <prog> is replaced to Program file base name (except extention).
|
257
|
+
# <host> is replaced to Hostname.
|
258
|
+
#
|
259
|
+
#log_name : "<date>_<time>_<prog>.log"
|
260
|
+
#log_name : "<date>_<prog>.log"
|
261
|
+
|
262
|
+
# Append Log
|
263
|
+
#
|
264
|
+
# Default is ture.
|
265
|
+
#
|
266
|
+
#log_append : true
|
267
|
+
#log_append : false
|
268
|
+
|
269
|
+
# Log Level
|
270
|
+
#
|
271
|
+
# Default is "info".
|
272
|
+
# Effective values are "debug","info","wran","error",and "fatal".
|
273
|
+
#
|
274
|
+
#log_level : "debug"
|
275
|
+
#log_level : "info"
|
276
|
+
#log_level : "warn"
|
277
|
+
#log_level : "error"
|
278
|
+
#log_level : "fatal"
|
279
|
+
|
280
|
+
# Print log string both file and STDOUT
|
281
|
+
#
|
282
|
+
# Default is false.
|
283
|
+
#
|
284
|
+
#log_stdout : true
|
285
|
+
#log_stdout : false
|
286
|
+
|
287
|
+
# Delete old log files
|
288
|
+
#
|
289
|
+
# Default is false.
|
290
|
+
# If this is true, delete old log file when RBatch::Log.new is called.
|
291
|
+
# A log file to delete is a log file which was made by the
|
292
|
+
# RBatch::Log instance, and log filename format include "<date>".
|
293
|
+
#
|
294
|
+
#log_delete_old_log: true
|
295
|
+
#log_delete_old_log: false
|
296
|
+
|
297
|
+
# The day of leaving log files
|
298
|
+
#
|
299
|
+
# Default is 7.
|
300
|
+
#
|
301
|
+
#log_delete_old_log_date: 14
|
302
|
+
|
303
|
+
# Send mail or not
|
304
|
+
#
|
305
|
+
# Default is false.
|
306
|
+
# When log.error(msg) or log.fatal(msg) called , send e-mail
|
307
|
+
# including "msg".
|
308
|
+
#
|
309
|
+
#log_send_mail : true
|
310
|
+
|
311
|
+
# Mail parameters
|
312
|
+
#
|
313
|
+
#log_mail_to : "xxx@sample.com"
|
314
|
+
#log_mail_from : "xxx@sample.com"
|
315
|
+
#log_mail_server_host : "localhost"
|
316
|
+
#log_mail_server_port : 25
|
317
|
+
|
318
|
+
# RBatch Journal Message Level
|
319
|
+
#
|
320
|
+
# Default is 1
|
321
|
+
# If 2, put more journal messages to STDOUT.
|
322
|
+
# If 0, put nothing.
|
323
|
+
# Example of journal essages are follows.
|
324
|
+
# [RBatch] Load Config : "../conf/hoge.yaml"
|
325
|
+
#
|
326
|
+
#rbatch_journal_level = 2
|
327
|
+
#rbatch_journal_level = 0
|
328
|
+
|
329
|
+
# Mix RBatch Journal to Logs
|
330
|
+
#
|
331
|
+
# Default is true.
|
332
|
+
# If true, mix RBatch journal messages to log file(s) which is(are) opened at time.
|
333
|
+
#
|
334
|
+
#mix_rbatch_journal_to_logs : true
|
335
|
+
#mix_rbatch_journal_to_logs : false
|
336
|
+
|
337
|
+
```
|
328
338
|
|
329
339
|
### Customize by passing option object to constructor
|
330
340
|
|
data/bin/rbatch-init
CHANGED
@@ -13,10 +13,9 @@ contents[".rbatchrc"] = <<EOF
|
|
13
13
|
# Conf Directory
|
14
14
|
#
|
15
15
|
# Default is "<home>/conf"
|
16
|
-
#
|
17
16
|
# <home> is replaced to ${RB_HOME}
|
18
17
|
#
|
19
|
-
#conf_dir: <home>/config
|
18
|
+
#conf_dir: <home>/config/
|
20
19
|
#conf_dir: /etc/rbatch/
|
21
20
|
|
22
21
|
# Common config file name
|
@@ -89,7 +88,7 @@ contents[".rbatchrc"] = <<EOF
|
|
89
88
|
#log_name : "<date>_<time>_<prog>.log"
|
90
89
|
#log_name : "<date>_<prog>.log"
|
91
90
|
|
92
|
-
# Append
|
91
|
+
# Append Log
|
93
92
|
#
|
94
93
|
# Default is ture.
|
95
94
|
#
|
@@ -118,8 +117,8 @@ contents[".rbatchrc"] = <<EOF
|
|
118
117
|
#
|
119
118
|
# Default is false.
|
120
119
|
# If this is true, delete old log file when RBatch::Log.new is called.
|
121
|
-
# A log file to delete is a log file which was made by the
|
122
|
-
# and log filename format include "<date>".
|
120
|
+
# A log file to delete is a log file which was made by the
|
121
|
+
# RBatch::Log instance, and log filename format include "<date>".
|
123
122
|
#
|
124
123
|
#log_delete_old_log: true
|
125
124
|
#log_delete_old_log: false
|
@@ -131,9 +130,10 @@ contents[".rbatchrc"] = <<EOF
|
|
131
130
|
#log_delete_old_log_date: 14
|
132
131
|
|
133
132
|
# Send mail or not
|
134
|
-
#
|
133
|
+
#
|
135
134
|
# Default is false.
|
136
|
-
# When log.error(msg) or log.fatal(msg) called , send e-mail
|
135
|
+
# When log.error(msg) or log.fatal(msg) called , send e-mail
|
136
|
+
# including "msg".
|
137
137
|
#
|
138
138
|
#log_send_mail : true
|
139
139
|
|
@@ -144,16 +144,24 @@ contents[".rbatchrc"] = <<EOF
|
|
144
144
|
#log_mail_server_host : "localhost"
|
145
145
|
#log_mail_server_port : 25
|
146
146
|
|
147
|
-
#
|
147
|
+
# RBatch Journal Message Level
|
148
148
|
#
|
149
|
-
# Default is
|
150
|
-
# If
|
151
|
-
#
|
149
|
+
# Default is 1
|
150
|
+
# If 2, put more journal messages to STDOUT.
|
151
|
+
# If 0, put nothing.
|
152
|
+
# Example of journal essages are follows.
|
152
153
|
# [RBatch] Load Config : "../conf/hoge.yaml"
|
153
154
|
#
|
154
|
-
#
|
155
|
-
#
|
155
|
+
#rbatch_journal_level = 2
|
156
|
+
#rbatch_journal_level = 0
|
156
157
|
|
158
|
+
# Mix RBatch Journal to Logs
|
159
|
+
#
|
160
|
+
# Default is true.
|
161
|
+
# If true, mix RBatch journal messages to log file(s) which is(are) opened at time.
|
162
|
+
#
|
163
|
+
#mix_rbatch_journal_to_logs : true
|
164
|
+
#mix_rbatch_journal_to_logs : false
|
157
165
|
EOF
|
158
166
|
|
159
167
|
contents["bin/hello_world.rb"] = <<EOF
|