recmon 1.0.7 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGELOG +3 -0
  2. data/README +8 -0
  3. data/lib/recmon/monitor.rb +11 -3
  4. metadata +3 -3
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ == Version 1.1.0
2
+ - Eliminated dependency on Daemons gem
3
+
1
4
  == Version 1.0.7
2
5
  - leave responsibility for daemonising to the calling script.
3
6
  - refined the sizing mechanisms (diskfree MB, diskspace MB, filesize bytes)
data/README CHANGED
@@ -37,6 +37,14 @@ and it will periodically write entries to the log file (default = +/var/log/recm
37
37
  ...
38
38
  2012-09-13T16:09:16+10:00 Recmon is exiting.
39
39
 
40
+ You can daemonise the process with the daemons rubygem:
41
+ require 'rubygems'
42
+ require 'recmon'
43
+ require 'daemons'
44
+ s = Recmon::Monitor.new()
45
+ # add sensors...
46
+ s.start()
47
+
40
48
  == Sensors
41
49
  There are several sensors:
42
50
 
@@ -1,6 +1,5 @@
1
1
  require 'time'
2
2
  require 'rubygems'
3
- require 'daemons'
4
3
 
5
4
  module Recmon
6
5
 
@@ -34,9 +33,18 @@ class Monitor
34
33
  }
35
34
  open_log()
36
35
  log("Recmon is monitoring.")
37
- monitor()
38
- while sleep(@freq)
36
+ # daemonise the process
37
+ fork do
38
+ Process.setsid
39
+ exit if fork
40
+ File.umask 0000
41
+ STDIN.reopen "/dev/null"
42
+ STDOUT.reopen "/dev/null"
43
+ STDERR.reopen "/dev/null"
39
44
  monitor()
45
+ while sleep(@freq)
46
+ monitor()
47
+ end
40
48
  end
41
49
  end
42
50
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recmon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 7
10
- version: 1.0.7
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Richard Kernahan