evesync 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +18 -10
- data/bin/evesync +31 -0
- data/lib/evesync.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89f74020a22ae230f9ff9d31d26a7983acde3cc073a4ef9e70e6f053d028e91f
|
4
|
+
data.tar.gz: 593bfa7b50fd6a2f17818cb00a9e1394c3409808c724469bc3bad706ead0e4ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 596d803d35d866764391284a1c65eead4e73d7ab7a73304d5d7f4b6275943988b829b340f87b676f3fc8aef99b589df2a5bbbd42297a22e577edaf4839a0f4c7
|
7
|
+
data.tar.gz: 5520247054b67b98b9753c07bf50ef099ea01e3f9777beaf23cbf0a2cf9947022e50e274ebb6c5bdebccde17c779361797d31b3d8acdb8f00c0afcbb90109f2d
|
data/Rakefile
CHANGED
@@ -68,17 +68,25 @@ task :down do
|
|
68
68
|
sh 'docker-compose rm --force ||:'
|
69
69
|
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
71
|
+
|
72
|
+
namespace :rhel do
|
73
|
+
begin
|
74
|
+
@release = `git rev-list HEAD master --count`
|
75
|
+
rescue
|
76
|
+
@release = 0
|
77
|
+
end
|
78
|
+
|
79
|
+
task :rpm do
|
80
|
+
sh("rpmbuild -bb "\
|
81
|
+
"--define 'VERSION #{VERSION}' "\
|
82
|
+
"--define 'RELEASE #{@release}' "\
|
83
|
+
"--define '_builddir #{Dir.pwd}' "\
|
84
|
+
"--define '_rpmdir #{Dir.pwd}/RPM/' "\
|
85
|
+
"evesync.spec")
|
86
|
+
sh('chown -R 1000:1000 RPM')
|
87
|
+
end
|
80
88
|
end
|
81
89
|
|
82
90
|
task :'build-rpm' do
|
83
|
-
sh('echo rake rpm | docker-compose run build-centos')
|
91
|
+
sh('echo rake rhel:rpm | docker-compose run build-centos')
|
84
92
|
end
|
data/bin/evesync
CHANGED
@@ -5,6 +5,7 @@ require 'optparse'
|
|
5
5
|
require 'socket'
|
6
6
|
require 'find'
|
7
7
|
require 'zip'
|
8
|
+
require 'fileutils'
|
8
9
|
require 'evesync'
|
9
10
|
require 'evesync/log'
|
10
11
|
require 'evesync/utils'
|
@@ -64,6 +65,36 @@ OptionParser.new do |parser|
|
|
64
65
|
puts parser
|
65
66
|
exit
|
66
67
|
end
|
68
|
+
|
69
|
+
# TODO: refactor
|
70
|
+
parser.on('-r', '--run', 'Start daemons') do
|
71
|
+
r, w = IO.pipe
|
72
|
+
data_pid = spawn('evedatad', :err => '/var/log/evesync/evedatad.log', :out=>:err)
|
73
|
+
mon_pid = spawn('evemond', :err => '/var/log/evesync/evemond.log', :out=>:err)
|
74
|
+
hand_pid = spawn('evehand', :err => '/var/log/evesync/evehand.log', :out=>:err)
|
75
|
+
sync_pid = spawn('evesyncd', :err => '/var/log/evesync/evesyncd.log', :out=>:err)
|
76
|
+
FileUtils.mkdir_p('/var/run/evesync')
|
77
|
+
File.write('/var/run/evesync/evedatad.pid', data_pid)
|
78
|
+
File.write('/var/run/evesync/evemond.pid', mon_pid)
|
79
|
+
File.write('/var/run/evesync/evehand.pid', hand_pid)
|
80
|
+
File.write('/var/run/evesync/evesyncd.pid', sync_pid)
|
81
|
+
end
|
82
|
+
|
83
|
+
parser.on('-k', '--kill', 'Stop daemons') do
|
84
|
+
begin
|
85
|
+
Process.kill('TERM', File.read('/var/run/evesync/evemond.pid').to_i)
|
86
|
+
Process.kill('TERM', File.read('/var/run/evesync/evehand.pid').to_i)
|
87
|
+
Process.kill('TERM', File.read('/var/run/evesync/evesyncd.pid').to_i)
|
88
|
+
Process.kill('TERM', File.read('/var/run/evesync/evedatad.pid').to_i)
|
89
|
+
rescue Errno::ESRCH => e
|
90
|
+
puts('Some process already killed')
|
91
|
+
rescue StandardError => e
|
92
|
+
puts("Error: #{e}")
|
93
|
+
puts('Something went wrong while killing processes. Do it yourself!')
|
94
|
+
ensure
|
95
|
+
FileUtils.rm_f Dir.glob('/var/run/evesync/*.pid')
|
96
|
+
end
|
97
|
+
end
|
67
98
|
end.parse!
|
68
99
|
|
69
100
|
def force_sync
|
data/lib/evesync.rb
CHANGED