gom-script 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/gom/remote/daemon.rb +19 -0
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -79,6 +79,25 @@ module Gom
79
79
  #@gom.write "#{service_path}:nagios_port", nagios_port
80
80
  end
81
81
  end
82
+
83
+ def redirect_log filepath
84
+ (@logfile_fd && @logfile_fd.close) rescue nil
85
+ puts " -- redirecting stdout/stderr to: #{filepath}"
86
+ if filepath == '-'
87
+ # when @stdout is not defined/nil, we leave the file descriptors as
88
+ # they are
89
+ if @stdout
90
+ $stdout, $stderr = @stdout, @stderr
91
+ end
92
+ else
93
+ @stdout, @stderr = $stdout, $stderr
94
+ @logfile_fd = File.open(filepath, File::WRONLY|File::APPEND|File::CREAT)
95
+ @logfile_fd.sync = true
96
+ $stderr = $stdout = @logfile_fd
97
+ end
98
+ # first line after redirect
99
+ puts " -- e-meter daemon logile redirect at #{Time.now}"
100
+ end
82
101
  end
83
102
  end
84
103
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gom-script
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - art+com/dirk luesebrink
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-08 00:00:00 +01:00
12
+ date: 2010-01-26 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency