Commit 5d1b6a66bb2e471ba245b625d3080e47cc238438

Authored by Athos
1 parent a7978199

Remove backups dir before downloading backups

Showing 1 changed file with 3 additions and 0 deletions   Show diff stats
@@ -86,8 +86,10 @@ if ['local', 'lxc'].include?($SPB_ENV) @@ -86,8 +86,10 @@ if ['local', 'lxc'].include?($SPB_ENV)
86 end 86 end
87 end 87 end
88 88
  89 +desc 'Downloads latest system backups to backups directory. WARNING: This overrides anything written in the backups directory'
89 task :backup => ssh_config_file do 90 task :backup => ssh_config_file do
90 # setup 91 # setup
  92 + sh 'rm', '-rf', 'backups'
91 sh 'mkdir', '-p', 'backups' 93 sh 'mkdir', '-p', 'backups'
92 # integration 94 # integration
93 sh 'ssh', '-F', ssh_config_file, 'integration', 'sudo', 'chmod a+xr /.snapshots' 95 sh 'ssh', '-F', ssh_config_file, 'integration', 'sudo', 'chmod a+xr /.snapshots'
@@ -97,6 +99,7 @@ task :backup => ssh_config_file do @@ -97,6 +99,7 @@ task :backup => ssh_config_file do
97 sh 'scp', '-F', ssh_config_file, 'social:/.snapshots/hourly.0/spb/*', 'backups/' 99 sh 'scp', '-F', ssh_config_file, 'social:/.snapshots/hourly.0/spb/*', 'backups/'
98 end 100 end
99 101
  102 +desc 'Restores content saved in the backups directory to the target env. WARNING: This will drop all the current databases'
100 task :restore => [ssh_config_file, config_file] do 103 task :restore => [ssh_config_file, config_file] do
101 # setup 104 # setup
102 sh 'ssh', '-F', ssh_config_file, 'integration', 'sudo', 'rm -rf /tmp/backups' 105 sh 'ssh', '-F', ssh_config_file, 'integration', 'sudo', 'rm -rf /tmp/backups'