myreplicator 1.1.56 → 1.1.57

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,6 +13,26 @@ module Myreplicator
13
13
  ActiveRecord::Base.configurations.keys.each do |db|
14
14
  Myreplicator::VerticaLoader.clean_up_temp_tables(db)
15
15
  end
16
+ folders = ["/home/share/datareplicator",
17
+ "/home/share/okl/bi_apps/datareplicator/mysqldumps"
18
+ ]
19
+
20
+ folders.each do |folder|
21
+ #cmd = "find #{folder} -mtime +2"
22
+ cmd = "find #{folder} -mmin +720"
23
+ l = `#{cmd}`
24
+ list = l.split(/\n/)
25
+ list.each do |file|
26
+ file.chomp!
27
+ if File.file?(file)
28
+ if (file.split('.').last == 'gz') || (file.split('.').last == 'json')
29
+ puts "=== #{file}"
30
+ File.delete(file)
31
+ end
32
+ end
33
+ end
34
+ end
35
+
16
36
  end
17
37
 
18
38
  end
@@ -277,6 +277,11 @@ module Myreplicator
277
277
  update_export(:state => state,
278
278
  :export_finished_at => Time.now,
279
279
  :error => metadata.error)
280
+ begin
281
+ Myreplicator::Loader.cleanup metadata
282
+ rescue Exception => e
283
+ puts e.message
284
+ end
280
285
  raise Exceptions::ExportError.new(metadata.error)
281
286
  end
282
287
  end
@@ -310,8 +310,26 @@ module Myreplicator
310
310
  ##
311
311
  def self.cleanup metadata
312
312
  puts "Cleaning up..."
313
+ e1 = nil
314
+ e2 = nil
315
+ begin
313
316
  FileUtils.rm metadata.metadata_filepath(tmp_dir) # json file
317
+ rescue Exception => e
318
+ e1 = e
319
+ puts e.message
320
+ end
321
+ begin
314
322
  FileUtils.rm metadata.destination_filepath(tmp_dir) # dump file
323
+ rescue Exception => e
324
+ e2 = e
325
+ puts e.message
326
+ end
327
+ if (!e1.blank?)
328
+ raise Exceptions::LoaderError.new("#{e1.message}")
329
+ end
330
+ if (!e2.blank?)
331
+ raise Exceptions::LoaderError.new("#{e2.message}")
332
+ end
315
333
  end
316
334
 
317
335
  ##
@@ -1,3 +1,3 @@
1
1
  module Myreplicator
2
- VERSION = "1.1.56"
2
+ VERSION = "1.1.57"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myreplicator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.56
4
+ version: 1.1.57
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-20 00:00:00.000000000 Z
12
+ date: 2013-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -341,7 +341,8 @@ files:
341
341
  - test/unit/myreplicator/log_test.rb
342
342
  - test/unit/myreplicator/vertica_export_test.rb
343
343
  homepage: https://github.com/Raybeam/myreplicator
344
- licenses: []
344
+ licenses:
345
+ - MIT
345
346
  post_install_message:
346
347
  rdoc_options: []
347
348
  require_paths:
@@ -354,7 +355,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
354
355
  version: '0'
355
356
  segments:
356
357
  - 0
357
- hash: -3616197384804184739
358
+ hash: -661295928114993181
358
359
  required_rubygems_version: !ruby/object:Gem::Requirement
359
360
  none: false
360
361
  requirements:
@@ -363,7 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
363
364
  version: '0'
364
365
  segments:
365
366
  - 0
366
- hash: -3616197384804184739
367
+ hash: -661295928114993181
367
368
  requirements: []
368
369
  rubyforge_project:
369
370
  rubygems_version: 1.8.24