logtwuncator 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +1 -1
- data/lib/log_twuncator.rb +1 -1
- data/lib/log_twuncator/daemon.rb +1 -1
- data/lib/log_twuncator/service.rb +4 -1
- metadata +4 -4
data/README.txt
CHANGED
@@ -72,8 +72,8 @@ To install service:
|
|
72
72
|
where:
|
73
73
|
-N : is the name of the service to install
|
74
74
|
-c : is the config file with the settings for various log monitoring paths
|
75
|
+
-l : is the log file for the truncator.
|
75
76
|
-d : is the number of minutes between checking the log files for truncation. Default is 5.
|
76
|
-
-l : is the log file for the truncator. Default is 'log_twuncator.log' is same folder as config file.
|
77
77
|
|
78
78
|
To remove service
|
79
79
|
|
data/lib/log_twuncator.rb
CHANGED
data/lib/log_twuncator/daemon.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'win32/service'
|
2
|
+
require 'win32/daemon'
|
2
3
|
require 'yaml'
|
3
4
|
require 'erb'
|
4
5
|
require 'logger'
|
@@ -19,7 +20,6 @@ module LogTwuncator
|
|
19
20
|
def initialize(options)
|
20
21
|
@config, @delay, @log = options[:config], options[:delay], options[:log]
|
21
22
|
@truncators = []
|
22
|
-
@log = File.join(File.dirname(@config), 'log_twuncator.log') unless options[:log]
|
23
23
|
@logger = Logger.new(@log)
|
24
24
|
end
|
25
25
|
|
@@ -64,6 +64,7 @@ module LogTwuncator
|
|
64
64
|
if @command == 'install'
|
65
65
|
errors << "Delay is required (switch -d)" unless @options[:delay]
|
66
66
|
errors << "Config file is required (switch -c)" unless @options[:config]
|
67
|
+
errors << "Log file is required (switch -l)" unless @options[:log]
|
67
68
|
errors << "Config file does not exist" if @options[:config] && !FileTest.exists?(@options[:config])
|
68
69
|
end
|
69
70
|
|
@@ -125,12 +126,14 @@ module LogTwuncator
|
|
125
126
|
path = "#{Config::CONFIG['bindir']}/rubyw #{Config::CONFIG['bindir']}/log_twuncator_daemon"
|
126
127
|
path << " -c #{@options[:config]}"
|
127
128
|
path << " -d #{@options[:delay]}"
|
129
|
+
path << " -l #{@options[:log]}"
|
130
|
+
path
|
128
131
|
end
|
129
132
|
|
130
133
|
def run(args)
|
131
134
|
command = LogTwuncator::ServiceCommand.new
|
132
135
|
@options = command.run(args)
|
133
|
-
|
136
|
+
send(command.command.to_sym)
|
134
137
|
end
|
135
138
|
end
|
136
139
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logtwuncator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Meehan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-03 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|