checking that filepath exists
This commit is contained in:
parent
c8e161f1cf
commit
868cb1efc1
1 changed files with 9 additions and 5 deletions
|
|
@ -47,12 +47,16 @@ namespace :backup do
|
||||||
(0..99).each do |n|
|
(0..99).each do |n|
|
||||||
padded_str = n.to_s.rjust(2,'0')
|
padded_str = n.to_s.rjust(2,'0')
|
||||||
file = photo_container.create_object(tar_name + padded_str)
|
file = photo_container.create_object(tar_name + padded_str)
|
||||||
if file.write File.open("/tmp/backup/" + tar_name + padded_str)
|
file_path = "/tmp/backup/" + tar_name + padded_str
|
||||||
puts("event=backup status=success type=photos")
|
|
||||||
else
|
if File.exists?(file_path)
|
||||||
puts("event=backup status=failure type=photos")
|
if file.write File.open(file_path)
|
||||||
|
puts("event=backup status=success type=photos")
|
||||||
|
else
|
||||||
|
puts("event=backup status=failure type=photos")
|
||||||
|
end
|
||||||
|
`rm #{file_path}`
|
||||||
end
|
end
|
||||||
`rm /tmp/backup/#{tar_name + padded_str}`
|
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue