sys_watchdog 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/lib/sys_watchdog/main.rb +19 -2
- data/lib/sys_watchdog/setup.rb +2 -1
- data/sys_watchdog.gemspec +1 -1
- metadata +1 -2
- data/images/dev_on_the_beach.jpg +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b5d8ce60452d7cb903a2697529859053766ef00
|
4
|
+
data.tar.gz: 5d15318e73ca47fd19b474cf16f05c3b1f907f03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 659d67ced91f0baa02dd6fec9eb55d4230d4e5ec1ccbec723436f015a68d6d57c53c42850db0b81a3a626678cdbf30657b69b8301eeb55c7aa6e7d3b9726f6c4
|
7
|
+
data.tar.gz: dfa89933f40756dc2f58f612e59a29092453e69e86eba8534bb182bae3ea5cacccae000a49e8a72b7857afc89781716440fa7b84722c4403b1c0edf6f63a4f4c
|
data/README.md
CHANGED
@@ -13,8 +13,6 @@ Take 20min to install and start to think what you\`ll make with your spare time
|
|
13
13
|
[Rio de Janeiro](https://www.google.com/search?q=rio+de+janeiro&source=lnms&tbm=isch&sa=X&ved=0ahUKEwi10v2Z8sjUAhXCcRQKHYvFBpMQ_AUIDCgD&biw=1440&bih=799)?
|
14
14
|
It\`s up to you ;)
|
15
15
|
|
16
|
-
![](images/dev_on_the_beach.jpg)
|
17
|
-
|
18
16
|
## Install
|
19
17
|
|
20
18
|
**Perform this and following steps logged as root user.**
|
data/lib/sys_watchdog/main.rb
CHANGED
@@ -3,7 +3,7 @@ class SysWatchdog
|
|
3
3
|
DEFAULT_LOG_FILE = '/var/log/sys_watchdog.log'
|
4
4
|
|
5
5
|
def initialize conf_file: nil, log_file: nil
|
6
|
-
log_file
|
6
|
+
log_file ||= DEFAULT_LOG_FILE
|
7
7
|
conf_file ||= DEFAULT_CONF_FILE
|
8
8
|
|
9
9
|
@logger = WdLogger.new log_file
|
@@ -37,7 +37,7 @@ class SysWatchdog
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def parse_conf conf_file
|
40
|
-
|
40
|
+
check_conf_file conf_file
|
41
41
|
|
42
42
|
conf = YAML.load_file conf_file
|
43
43
|
conf.deep_symbolize_keys!
|
@@ -49,6 +49,23 @@ class SysWatchdog
|
|
49
49
|
}
|
50
50
|
end
|
51
51
|
|
52
|
+
def check_conf_file conf_file
|
53
|
+
unless File.readable? conf_file
|
54
|
+
raise "Conf file #{conf_file} not found or unreadable. Aborting."
|
55
|
+
end
|
56
|
+
|
57
|
+
conf_stat = File.stat conf_file
|
58
|
+
|
59
|
+
unless conf_stat.mode.to_s(8) =~ /0600$/
|
60
|
+
raise "Conf file #{conf_file} must have mode 0600. Aborting."
|
61
|
+
end
|
62
|
+
|
63
|
+
unless (conf_stat.uid == 0 and conf_stat.gid == 0) or
|
64
|
+
(conf_stat.uid == Process.uid and conf_stat.gid == Process.gid)
|
65
|
+
raise "Conf file #{conf_file} must have uid/gid set to root or to current running uid/gid. Aborting."
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
52
69
|
def run_test test, after_restore: false
|
53
70
|
new_status, exitstatus, output = test.run
|
54
71
|
|
data/lib/sys_watchdog/setup.rb
CHANGED
data/sys_watchdog.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sys_watchdog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Lobato
|
@@ -54,7 +54,6 @@ files:
|
|
54
54
|
- _config.yml
|
55
55
|
- bin/sys_watchdog
|
56
56
|
- gempush
|
57
|
-
- images/dev_on_the_beach.jpg
|
58
57
|
- images/register-bot.png
|
59
58
|
- lib/sys_watchdog.rb
|
60
59
|
- lib/sys_watchdog/core_extensions.rb
|
data/images/dev_on_the_beach.jpg
DELETED
Binary file
|