sys_watchdog 0.1.6 → 0.1.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f967392868433183e78167d57bb19148cec58de
4
- data.tar.gz: b78f4a2e2906e752139cc1f79161fc3b4ee0259b
3
+ metadata.gz: 63f809a622a062379d83d46e692ad7eaeaace9f5
4
+ data.tar.gz: 163db8efeb1271d866c59e5202dc43123028c71e
5
5
  SHA512:
6
- metadata.gz: 324baced42509f03a10e7d21b43a265621e61587b03413577caa99fd81154a7a96db6b43d20f221fbf76201cc2a752373eabe7aac6adc34e800dbbefccca7634
7
- data.tar.gz: 3d24f44cd12e2b18d29d4c4eee39650deca78b21ef9aae4197c5cd5f9cdc1a5c6fb75d428541de35721e74aa9c54654a02270ea8ae6ea8570e499d15b253b9d5
6
+ metadata.gz: 4fca59fb5a74e5aa360d3d4fa954a94737083a5fe1240dcaa8861344e65baa8b2a0f85ccffc5f3e72ef870f8f0b9d828c18ef9d51f37a307fcb93ff40df1208c
7
+ data.tar.gz: 2db6802883e063bc72d94a8975d8d55cee7902c1f5e0eb032b7915c3a8a9079ff1d17f0ca4863cb4efaeb3a710edcda463e80f8fa4c914064ca37f90e39b4513
data/README.md CHANGED
@@ -1,12 +1,13 @@
1
- Sys Watchdog
1
+ sys_watchdog
2
2
  =================
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/sys_watchdog.svg)](https://badge.fury.io/rb/sys_watchdog)
5
5
  [![Code Climate](https://codeclimate.com/github/tomlobato/sys_watchdog.svg)](https://codeclimate.com/github/tomlobato/sys_watchdog)
6
-
6
+ ![](http://ruby-gem-downloads-badge.herokuapp.com/sys_watchdog?type=total&label=gem%20downloads)
7
+
7
8
  By [Bettercall.io](https://bettercall.io/).
8
9
 
9
- SysWatchdog keeps your *NIX servers green by performing periodic checks and optionally actions like service restarts and notifications.
10
+ sys_watchdog keeps your *NIX servers green by performing periodic checks and optionally actions like service restarts and notifications.
10
11
 
11
12
  Take 20min to install and start to think what you\`ll make with your spare time ;)
12
13
 
data/TODO CHANGED
@@ -19,4 +19,8 @@ flexibilize period, currently hardcoded to 60s
19
19
 
20
20
  Lockfile for process
21
21
 
22
- lock for sys tests
22
+ lock for sys tests
23
+
24
+ remove slack-ruby-client from Gemfile. If it is set in .yml and is not available, send a error to log with instructions to install.
25
+
26
+ adjusts dependencies verions
data/bin/sys_watchdog CHANGED
@@ -5,10 +5,10 @@ require 'sys_watchdog'
5
5
  case ARGV[0]
6
6
 
7
7
  when 'setup_with_systemd'
8
- Setup.new.setup_with_systemd
8
+ Setup.new.with_systemd
9
9
 
10
10
  when 'setup_with_cron'
11
- Setup.new.setup_with_cron
11
+ Setup.new.with_cron
12
12
 
13
13
  when 'test'
14
14
  sw = SysWatchdog.new log_file: STDOUT
@@ -29,8 +29,9 @@ class SysWatchdog
29
29
  end
30
30
  end
31
31
  if @conf.smtp_server
32
+ _conf = @conf
32
33
  Mail.defaults do
33
- delivery_method :smtp, address: @conf.smtp_server, port: 587, :domain => @conf.smtp_domain,
34
+ delivery_method :smtp, address: _conf.smtp_server, port: 587, :domain => _conf.smtp_domain,
34
35
  :enable_starttls_auto => true, :openssl_verify_mode => 'none'
35
36
  end
36
37
  end
@@ -80,7 +81,7 @@ class SysWatchdog
80
81
  test.restore
81
82
  run_test test, after_restore: true
82
83
  else
83
- fail test, exitstatus, output
84
+ fail test, output
84
85
  end
85
86
  end
86
87
  rescue => e
@@ -94,9 +95,9 @@ class SysWatchdog
94
95
  end
95
96
  end
96
97
 
97
- def fail test, exitstatus, output
98
- body = "exitstatus: #{exitstatus}"
99
- body += "\noutput: #{output}" if output and not output.empty?
98
+ def fail test, output
99
+ body = ""
100
+ body += "output: #{output}" if output and not output.empty?
100
101
  notify "#{test.name} fail", body
101
102
  end
102
103
  end
@@ -36,7 +36,7 @@ class SysWatchdog
36
36
  end
37
37
 
38
38
  def server_name
39
- @conf.server_name || `hostname`
39
+ @conf.server_name || `hostname`.strip
40
40
  end
41
41
 
42
42
  def append_sys_info
@@ -11,10 +11,10 @@ class Setup
11
11
  puts "Installed."
12
12
 
13
13
  puts "\nEdit #{SysWatchdog::DEFAULT_CONF_FILE} and start:"
14
- puts "systemctl start sys_watchdog"
14
+ puts "systemctl start sys-watchdog"
15
15
 
16
16
  puts "\nTo check daemon status:"
17
- puts "systemctl status sys_watchdog"
17
+ puts "systemctl status sys-watchdog"
18
18
  end
19
19
 
20
20
  def with_cron
@@ -29,7 +29,7 @@ class Setup
29
29
  private
30
30
 
31
31
  def add_cron_line
32
- run "echo '#* * * * * root sys_watchdog once' >> /etc/crontab"
32
+ run "echo '#* * * * * root /bin/bash -lc \'sys_watchdog once\' >> /etc/crontab"
33
33
  end
34
34
 
35
35
  def install_systemd_service
@@ -45,10 +45,10 @@ class Setup
45
45
  exit 1
46
46
  end
47
47
 
48
- copy "#{@thisdir}/../../util/sys_watchdog.service",
48
+ copy "#{@thisdir}/../../util/sys-watchdog.service",
49
49
  services_dir
50
50
 
51
- run 'systemctl enable sys_watchdog'
51
+ run 'systemctl enable sys-watchdog'
52
52
  end
53
53
 
54
54
  def copy_sample_conf
data/sys_watchdog.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "sys_watchdog"
3
- s.version = "0.1.6"
3
+ s.version = "0.1.7"
4
4
  s.authors = ["Tom Lobato"]
5
5
  s.email = "lobato@bettercall.io"
6
6
  s.homepage = "http://sys-watchdog.bettercall.io/"
@@ -0,0 +1,11 @@
1
+
2
+ [Unit]
3
+ Description=sys_watchdog supervisor
4
+
5
+ [Service]
6
+ User=root
7
+ Group=root
8
+ Restart=on-failure
9
+ ExecStart=/bin/bash -lc 'sys_watchdog'
10
+ StandardOutput=syslog
11
+ StandardError=syslog
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.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Lobato
@@ -68,7 +68,7 @@ files:
68
68
  - sys_watchdog.gemspec
69
69
  - test/sys_watchdog_test.yml
70
70
  - test/test_sys_watchdog.rb
71
- - util/sys_watchdog.service
71
+ - util/sys-watchdog.service
72
72
  - util/sys_watchdog_sample.yml
73
73
  homepage: http://sys-watchdog.bettercall.io/
74
74
  licenses:
@@ -1,11 +0,0 @@
1
-
2
- [Unit]
3
- Description=SysWatchdog supervisor
4
-
5
- [Service]
6
- User=root
7
- Group=root
8
- WorkingDirectory=/var/local/sys_watchdog
9
- Restart=on-failure
10
- ExecStart=/usr/local/sys_watchdog/sys_watchdog
11
-