rbatch 2.1.9 → 2.2.0

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.
data/CHANGELOG CHANGED
@@ -1,7 +1,8 @@
1
1
  CHANGE LOG
2
2
 
3
- This document includes functions which is added or changed, does not include bugfix.
4
- About bugfix, see commit log of https://github.com/fetaro/rbatch .
3
+ This document includes functions which is added or changed.
4
+ This document does NOT include bugfix.
5
+ If you want to know about bug fix, please see commit logs of https://github.com/fetaro/rbatch .
5
6
 
6
7
  ===================
7
8
  version 1
@@ -13,64 +14,61 @@ version 1
13
14
 
14
15
  1.1 (2012/11/9)
15
16
  -----
16
- * add common config file
17
- * change log option
17
+ * [add] common config file
18
+ * [change] new option : "log"
18
19
 
19
20
  1.2 (2012/11/13)
20
21
  -----
21
- * change log level option format
22
- * add log append option
22
+ * [change] log level option format
23
+ * [add] new option : "log_append"
23
24
 
24
25
  1.3 (2012/12/30)
25
26
  -----
26
- * add RBatch::Log to instance interface
27
- * add double run check option
27
+ * [add] add customize point to RBatch::Log's constructor
28
+ * [add] new option : "double_run_check"
28
29
 
29
30
  1.4 (2013/1/5)
30
31
  ----
31
- * add log_stdout option
32
- * add sample code
33
- * add cmd_raise option
34
- * add log_delete_old_log option
32
+ * [add] new options : "log_stdout", "cmd_raise", "log_delete_old_log"
33
+ * [add] add sample code
35
34
 
36
35
  1.5 (2013/1/11)
37
36
  ----
38
- * change default config dir "../config" -> "../conf"
37
+ * [change] change default config dir from "../config" to "../conf"
39
38
 
40
39
  1.6 (2013/1/14)
41
40
  ----
42
- * add config key check
41
+ * [add] add function of cheking config keys
43
42
 
44
43
  1.7 (2013/01/30)
45
44
  ----
46
- * change log format
47
- * delete change log format option
45
+ * [change] log format
46
+ * [delete] change log format option
48
47
 
49
48
  1.8 (2013/02/10)
50
49
  ----
51
- * add log_send_mail option
52
- * add cmd_timeout option
50
+ * [add] new option : "log_send_mail", "cmd_timeout"
53
51
 
54
52
  1.9 (2013/02/11)
55
53
  ----
56
- * add "<host>" keyword to log_name option
57
- * change Environmental variables ($TMPDIR and $HOSTNAME) are checked strictly
54
+ * [add] add "<host>" keyword to log_name option
55
+ * [change] Environmental variables ($TMPDIR and $HOSTNAME) are checked strictly
58
56
 
59
57
  1.10 (2013/02/12)
60
58
  ----
61
- * add rbatch-init command
59
+ * [add] add rbatch-init command
62
60
 
63
61
  1.11 (2013/02/24)
64
62
  ----
65
- * add support for MAC-OSX environment (change handling of the environment variable about hostname and temporary directory)
63
+ * [add] support for MAC-OSX environment (change handling of the environment variable about hostname and temporary directory)
66
64
 
67
65
  1.12 (2013/11/19)
68
66
  ----
69
- * add Common Config Function
67
+ * [add] add Common Config Function
70
68
 
71
69
  1.13 (2013/12/19)
72
70
  ----
73
- * add customize point that can change RBatch home directory by using the environment variables, ${RB_HOME}.
71
+ * [add] add customize point that can change RBatch home directory by using the environment variables, ${RB_HOME}.
74
72
 
75
73
  ===================
76
74
  version 2
@@ -78,15 +76,19 @@ version 2
78
76
 
79
77
  2.0.0 (2013/12/28)
80
78
  ----
81
- * change Run-Conf path from "${RB_HOME}/conf/rbatch.yaml" to "${RB_HOME}/.rbatchrc"
82
- * add checking existence of Run-Conf keys.
83
- * add option. "conf_dir", "common_conf_name", and "cmd_timeout" are added.
84
- * when cmd_timeout occured, RBatch kill child process now.
85
- * change test code from Test::Unit to RSpec.
79
+ * [change] Change Run-Conf path from "${RB_HOME}/conf/rbatch.yaml" to "${RB_HOME}/.rbatchrc"
80
+ * [add] add function of checking existence of Run-Conf's keys.
81
+ * [add] new options : "conf_dir", "common_conf_name", "cmd_timeout".
82
+ * [add] when cmd_timeout occured, RBatch kill child process now.
83
+ * [change] Change test code from Test::Unit to RSpec.
86
84
 
87
85
  2.1.0 (2013/1/10)
88
86
  ----
89
- * add error handling when key class mistake Symbol for String
90
- * add auto library file reading
91
- * add mix_rbatch_msg_to_log option
92
- * change config reading timing. before ondemand, now initial.
87
+ * [add] add an error handling when user mistake key class as Symbol for String in config file.
88
+ * [add] add function of auto library file reading
89
+ * [add] new option : "mix_rbatch_msg_to_log"
90
+ * [change] config reading timing. before ondemand, now initial.
91
+
92
+ 2.2.0 (2014/4/15)
93
+ ----
94
+ * [add] now "log_mail_to" option accepts multiple recipients, before it accepts only one recipient.
data/README.ja.md CHANGED
@@ -315,21 +315,29 @@ Run-Conf(`${RB_HOME}/.rbatchrc`)のサンプルは以下の通り
315
315
  #forbid_double_run : true
316
316
  #forbid_double_run : false
317
317
 
318
- # RBatchの実行ログ(Journal)のLevel
318
+ # RBatchジャーナルのLevel
319
319
  #
320
320
  # デフォルトは1
321
- # 大きい数を指定すると多くの実行ログが出力される。
321
+ # RBatchジャーナルはRBatch自体の実行ログであり、[RBatch] の接頭辞が
322
+ # 付くメッセージである。通常は標準出力に出力される
323
+ # 大きい数を指定すると多くのジャーナルが出力される。
322
324
  # 0を指定すると何も表示されない。
323
- # RBatchメッセージの例
324
- # [RBatch] Load Config : "../conf/hoge.yaml"
325
+ #
326
+ # RBatchジャーナルの例
327
+ # [RBatch] === START RBatch === (PID=5795)
328
+ # [RBatch] RB_HOME : "/path/to/"
329
+ # [RBatch] Load Run-Conf: "/path/to/.rbatchrc"
330
+ # [RBatch] Start Script : "/path/to/bin/hello.rb"
331
+ # ....
325
332
  #
326
333
  #rbatch_journal_level : 2
327
334
  #rbatch_journal_level : 0
328
335
 
329
- # RBatchの実行ログをログに混ぜ込む
336
+ # RBatchジャーナルをログに混ぜ込む
330
337
  #
331
338
  # デフォルトは true。
332
- # trueを指定すると、RBatchメッセージをその時開かれているログに混ぜこむ。
339
+ # trueを指定すると、RBatchジャーナルを標準出力だけでなく
340
+ # その時開かれているログにも出力する。
333
341
  #
334
342
  #mix_rbatch_journal_to_logs : true
335
343
  #mix_rbatch_journal_to_logs : false
@@ -409,6 +417,13 @@ Run-Conf(`${RB_HOME}/.rbatchrc`)のサンプルは以下の通り
409
417
  #log_mail_from : "xxx@sample.com"
410
418
  #log_mail_server_host : "localhost"
411
419
  #log_mail_server_port : 25
420
+ #
421
+ # 宛先を複数指定した場合は
422
+ #
423
+ #log_mail_to :
424
+ # - "AAA@sample.com"
425
+ # - "BBB@sample.com"
426
+
412
427
 
413
428
  # -------------------
414
429
  # 外部コマンド実行関連
data/README.md CHANGED
@@ -313,21 +313,28 @@ Sample of RBatch Run-Conf `${RB_HOME}/.rbatchrc`.
313
313
  #forbid_double_run: true
314
314
  #forbid_double_run: false
315
315
 
316
- # Journal Message Level
316
+ # RBatch Journal Level
317
317
  #
318
318
  # Default is 1
319
- # If 2, put more journal messages to STDOUT.
319
+ # RBatch Journal is message of RBatch and is output to STDOUT.
320
+ # If 2, put much more information.
320
321
  # If 0, put nothing.
321
- # Example of journal essages are follows.
322
- # [RBatch] Load Config : "../conf/hoge.yaml"
322
+ #
323
+ # Example of RBatch Journal are follows.
324
+ # [RBatch] === START RBatch === (PID=5795)
325
+ # [RBatch] RB_HOME : "/path/to/"
326
+ # [RBatch] Load Run-Conf: "/path/to/.rbatchrc"
327
+ # [RBatch] Start Script : "/path/to/bin/hello.rb"
328
+ # ....
323
329
  #
324
330
  #rbatch_journal_level : 2
325
331
  #rbatch_journal_level : 0
326
332
 
327
- # Mix Journal Message to Logs
333
+ # Mix RBatch Journal to Logs
328
334
  #
329
335
  # Default is true.
330
- # If true, mix RBatch journal messages to log file(s) which is(are) opened at time.
336
+ # If true, RBatch Journal is output not only STDOUT
337
+ # but also log file(s) which is(are) opened at time.
331
338
  #
332
339
  #mix_rbatch_journal_to_logs : true
333
340
  #mix_rbatch_journal_to_logs : false
@@ -406,6 +413,12 @@ Sample of RBatch Run-Conf `${RB_HOME}/.rbatchrc`.
406
413
  #log_mail_from : "xxx@sample.com"
407
414
  #log_mail_server_host : "localhost"
408
415
  #log_mail_server_port : 25
416
+ #
417
+ # if you want to send multiple recipients...
418
+ #
419
+ #log_mail_to :
420
+ # - "AAA@sample.com"
421
+ # - "BBB@sample.com"
409
422
 
410
423
  # -------------------
411
424
  # Cmd setting
data/bin/rbatch-init CHANGED
@@ -47,21 +47,28 @@ contents[".rbatchrc"] = <<EOF
47
47
  #forbid_double_run : true
48
48
  #forbid_double_run : false
49
49
 
50
- # Journal Message Level
50
+ # RBatch Journal Level
51
51
  #
52
52
  # Default is 1
53
- # If 2, put more journal messages to STDOUT.
53
+ # RBatch Journal is message of RBatch and is output to STDOUT.
54
+ # If 2, put much more information.
54
55
  # If 0, put nothing.
55
- # Example of journal essages are follows.
56
- # [RBatch] Load Config : "../conf/hoge.yaml"
56
+ #
57
+ # Example of RBatch Journal are follows.
58
+ # [RBatch] === START RBatch === (PID=5795)
59
+ # [RBatch] RB_HOME : "/path/to/"
60
+ # [RBatch] Load Run-Conf: "/path/to/.rbatchrc"
61
+ # [RBatch] Start Script : "/path/to/bin/hello.rb"
62
+ # ....
57
63
  #
58
64
  #rbatch_journal_level : 2
59
65
  #rbatch_journal_level : 0
60
66
 
61
- # Mix Journal Message to Logs
67
+ # Mix RBatch Journal to Logs
62
68
  #
63
69
  # Default is true.
64
- # If true, mix RBatch journal messages to log file(s) which is(are) opened at time.
70
+ # If true, RBatch Journal is output not only STDOUT
71
+ # but also log file(s) which is(are) opened at time.
65
72
  #
66
73
  #mix_rbatch_journal_to_logs : true
67
74
  #mix_rbatch_journal_to_logs : false
@@ -141,6 +148,12 @@ contents[".rbatchrc"] = <<EOF
141
148
  #log_mail_from : "xxx@sample.com"
142
149
  #log_mail_server_host : "localhost"
143
150
  #log_mail_server_port : 25
151
+ #
152
+ # if you want to send multiple recipients...
153
+ #
154
+ #log_mail_to :
155
+ # - "AAA@sample.com"
156
+ # - "BBB@sample.com"
144
157
 
145
158
  # -------------------
146
159
  # Cmd setting
data/lib/rbatch/log.rb CHANGED
@@ -234,9 +234,15 @@ module RBatch
234
234
  end
235
235
 
236
236
  def send_mail(msg)
237
+ if @vars[:log_mail_to].class == Array
238
+ mail_to_str = @vars[:log_mail_to].join(",")
239
+ else
240
+ mail_to_str = @vars[:log_mail_to]
241
+ end
242
+
237
243
  body = <<EOT
238
- From: <#{@vars[:log_mail_from]}>
239
- To: <#{@vars[:log_mail_to]}>
244
+ From: #{@vars[:log_mail_from]}
245
+ To: #{mail_to_str}
240
246
  Subject: [RBatch] #{@vars[:program_name]} has error
241
247
  Date: #{Time::now.strftime("%a, %d %b %Y %X %z")}
242
248
  Mime-Version: 1.0
@@ -248,6 +254,7 @@ EOT
248
254
  Net::SMTP.start(@vars[:log_mail_server_host],@vars[:log_mail_server_port] ) {|smtp|
249
255
  smtp.send_mail(body,@vars[:log_mail_from],@vars[:log_mail_to])
250
256
  }
257
+ @@journal.put 1,"Send an error mail from #{@vars[:log_mail_from]} to #{mail_to_str} by #{@vars[:log_mail_server_host]}:#{@vars[:log_mail_server_port]}"
251
258
  end
252
259
  end # end class
253
260
  class LogException < StandardError ; end
@@ -1,3 +1,3 @@
1
1
  module RBatch
2
- VERSION = "2.1.9"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rbatch
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.1.9
5
+ version: 2.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - fetaro