logtwuncator 0.1.4 → 0.1.5
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/README.txt +4 -4
- data/Rakefile +1 -1
- data/lib/log_twuncator/service.rb +10 -13
- data/lib/log_twuncator.rb +1 -1
- metadata +8 -7
data/README.txt
CHANGED
@@ -67,7 +67,7 @@ For help
|
|
67
67
|
|
68
68
|
To install service:
|
69
69
|
|
70
|
-
|
70
|
+
log_twuncator_service install -N log_twuncator -c c:/twuncator_config.yml -d 1 -l c:/log_twuncator.log
|
71
71
|
|
72
72
|
where:
|
73
73
|
-N : is the name of the service to install
|
@@ -77,13 +77,13 @@ To install service:
|
|
77
77
|
|
78
78
|
To remove service
|
79
79
|
|
80
|
-
|
80
|
+
log_twuncator_service remove -N log_twuncator
|
81
81
|
|
82
82
|
To start/stop service
|
83
83
|
|
84
|
-
|
84
|
+
log_twuncator_service start -N log_twuncator
|
85
85
|
|
86
|
-
|
86
|
+
log_twuncator_service stop -N log_twuncator
|
87
87
|
|
88
88
|
And remember kids the service creation does not set the startup-type to 'Automatic',
|
89
89
|
so if you it want it to start with every windows startup then change this setting in
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ Hoe.new('logtwuncator', LogTwuncator::VERSION) do |p|
|
|
11
11
|
p.summary = 'A win32 log file truncator and archiver with windows service'
|
12
12
|
p.description = 'A win32 log file truncator and archiver with windows service'
|
13
13
|
p.url = 'http://rubygems.org/gems/logtwuncator'
|
14
|
-
p.extra_deps << ['win32-service', '~> 0.
|
14
|
+
p.extra_deps << ['win32-service', '~> 0.7.2']
|
15
15
|
end
|
16
16
|
|
17
17
|
# vim: syntax=Ruby
|
@@ -6,8 +6,7 @@ module LogTwuncator
|
|
6
6
|
attr_reader :command, :options
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
@options = {}
|
10
|
-
@options[:delay] = 5
|
9
|
+
@options = { :delay => 5}
|
11
10
|
end
|
12
11
|
|
13
12
|
def run(args)
|
@@ -80,35 +79,33 @@ module LogTwuncator
|
|
80
79
|
class Service
|
81
80
|
|
82
81
|
def install
|
83
|
-
svc = Win32::Service.new
|
84
82
|
if Win32::Service.exists?(@options[:name])
|
85
83
|
puts "Service name '#{@options[:name]}' already exists."
|
86
84
|
return
|
87
85
|
end
|
88
86
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
87
|
+
Win32::Service.new({
|
88
|
+
:service_name => @options[:name],
|
89
|
+
:display_name => @options[:name],
|
90
|
+
:binary_path_name => binary_path_name
|
91
|
+
})
|
94
92
|
|
95
|
-
svc.close
|
96
93
|
puts "Log Twuncator service '#{@options[:name]}' installed."
|
97
|
-
rescue Win32::
|
94
|
+
rescue Win32::Service::Error => e
|
98
95
|
puts "Service '#{@options[:name]}' failed to install due to error: #{e.message}"
|
99
96
|
end
|
100
97
|
|
101
98
|
def start
|
102
99
|
Win32::Service.start(@options[:name])
|
103
100
|
puts "'#{@options[:name]}' service started."
|
104
|
-
rescue Win32::
|
101
|
+
rescue Win32::Service::Error => e
|
105
102
|
puts "Service '#{@options[:name]}' failed to start due to error: #{e.message}"
|
106
103
|
end
|
107
104
|
|
108
105
|
def stop
|
109
106
|
Win32::Service.stop(@options[:name])
|
110
107
|
puts "'#{@options[:name]}' service stopped."
|
111
|
-
rescue Win32::
|
108
|
+
rescue Win32::Service::Error => e
|
112
109
|
puts "Service '#{@options[:name]}' failed to stop due to error: #{e.message}"
|
113
110
|
end
|
114
111
|
|
@@ -120,7 +117,7 @@ module LogTwuncator
|
|
120
117
|
|
121
118
|
Win32::Service.delete(@options[:name])
|
122
119
|
puts "'#{@options[:name]}' service removed."
|
123
|
-
rescue Win32::
|
120
|
+
rescue Win32::Service::Error => e
|
124
121
|
puts "Service '#{@options[:name]}' failed to be removed due to error: #{e.message}"
|
125
122
|
end
|
126
123
|
|
data/lib/log_twuncator.rb
CHANGED
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: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
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: 2011-12-
|
18
|
+
date: 2011-12-31 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,11 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 7
|
30
30
|
segments:
|
31
31
|
- 0
|
32
|
-
-
|
33
|
-
|
32
|
+
- 7
|
33
|
+
- 2
|
34
|
+
version: 0.7.2
|
34
35
|
prerelease: false
|
35
36
|
requirement: *id001
|
36
37
|
- !ruby/object:Gem::Dependency
|