Permalink
Browse files

deleting temporal files

  • Loading branch information...
1 parent 57e3e5d commit c816db06b28196ad9acdd4d17a1b115e0f79cfd5 @fguillen committed Aug 13, 2010
Showing with 5 additions and 3 deletions.
  1. +3 −3 configuration.test.yml
  2. +2 −0 sweety_backy.rb
View
6 configuration.test.yml
@@ -1,12 +1,12 @@
includes: [ "#tmp_dir#/to_back" ]
excludes: [ "#tmp_dir#/to_back/b", "#tmp_dir#/to_back/c", "*exclude*" ]
-databases: ['information_schema']
+databases: ['test']
database_user: root
database_pass:
path: '#tmp_dir#'
yearly: 1
monthly: 4
weekly: 2
daily: 5
-tar_path: '/sw/bin/tar'
-mysqldump_path: '/opt/mysql/bin//mysqldump'
+tar_path: '/usr/bin/tar'
+mysqldump_path: '/usr/local/bin/mysqldump'
View
2 sweety_backy.rb
@@ -38,6 +38,7 @@ def do_files_backup( path )
exclude_file_path = File.join( Dir::tmpdir, "#{Time.now.to_i}_exclude.txt" )
File.open( exclude_file_path, 'w' ) { |f| f.write @opts[:excludes].join("\n") }
Utils::command( "#{@opts[:tar_path]} -cz --same-permissions --file #{path} --exclude-from #{exclude_file_path} #{@opts[:includes].join(' ')}" )
+ File.delete( exclude_file_path )
end
def do_databases_backup( path )
@@ -48,6 +49,7 @@ def do_databases_backup( path )
database_pass = (@opts[:database_pass].nil? || @opts[:database_pass]=='') ? '' : "-p'#{@opts[:database_pass]}'"
Utils::command( "#{@opts[:mysqldump_path]} -u#{@opts[:database_user]} #{database_pass} --databases #{@opts[:databases].join(' ')} > #{tmp_sql_file_path}" )
Utils::command( "#{@opts[:tar_path]} -cz --same-permissions --file #{path} --directory #{File.dirname(tmp_sql_file_path)} #{File.basename(tmp_sql_file_path)}" )
+ File.delete( tmp_sql_file_path )
end
def clear

0 comments on commit c816db0

Please sign in to comment.