Skip to content

Commit

Permalink
Added epoch timestamp to filenames to allow for same-day backups with…
Browse files Browse the repository at this point in the history
…out overwriting existing file. ie, old: app_2008-06-06_db.tar.gz -vs- new: app_2008-06-06_1212820789_db.tar.gz
  • Loading branch information
Adam Roth authored and Adam Roth committed Jun 7, 2008
1 parent d51fa7a commit 3552cfa
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/backup_fu.rb
Expand Up @@ -153,8 +153,7 @@ def dump_base_path
end

def db_filename
date_formatted = Time.now.strftime("%Y-%m-%d")
"#{@fu_conf[:app_name]}_#{date_formatted}_db.sql"
"#{@fu_conf[:app_name]}_#{datetime_formatted}_db.sql"
end

def db_filename_tarred
Expand All @@ -171,14 +170,12 @@ def final_db_dump_path
end

def static_tar_path
date_formatted = Time.now.strftime("%Y-%m-%d")
f = "#{@fu_conf[:app_name]}_#{date_formatted}_static.tar"
f = "#{@fu_conf[:app_name]}_#{datetime_formatted}_static.tar"
File.join(dump_base_path, f)
end

def final_static_dump_path
date_formatted = Time.now.strftime("%Y-%m-%d")
f = "#{@fu_conf[:app_name]}_#{date_formatted}_static.tar.gz"
f = "#{@fu_conf[:app_name]}_#{datetime_formatted}_static.tar.gz"
File.join(dump_base_path, f)
end

Expand All @@ -197,6 +194,9 @@ def niceify(cmd)
cmd
end
end

def datetime_formatted
Time.now.strftime("%Y-%m-%d") + "_#{ Time.now.tv_sec }"
end


end
end

0 comments on commit 3552cfa

Please sign in to comment.