summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-02-26 16:17:05 -0500
committerPeter Kozak <spag@golwen.net>2013-02-26 16:17:05 -0500
commitc175bbeec5c1573ba34da80cd1ec024e2be32b40 (patch)
tree28b6373dd4ffefa1897a0e91b67f19ec8fb2795f /lib
parentbc45716cb2aa3cd81ad5519edac8e09239a45984 (diff)
parent177a2c037468e222191b6668eb8e64a94833b18c (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/backup.rake11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake
index d12bf5e..8e55be2 100644
--- a/lib/tasks/backup.rake
+++ b/lib/tasks/backup.rake
@@ -13,16 +13,17 @@ namespace :backup do
tmp_dir = "/tmp/gs5_restore_directory"
FileUtils.rm_rf tmp_dir
FileUtils.mkdir_p tmp_dir
- system "cd #{tmp_dir} && tar xzf #{restore_job.backup_file.path}"
- system "cd /tmp/gs5_restore_directory/*/ && tar xf GS5.tar && rm GS5.tar"
+ system "cd #{tmp_dir} && sudo /bin/tar xzf #{restore_job.backup_file.path}"
+ restore_directory = Dir.glob("/tmp/gs5_restore_directory/*").first
+ system "cd #{restore_directory} && sudo /bin/tar xf GS5.tar && rm GS5.tar"
# Restore faxes
#
- system "cd / && tar xzfP /tmp/gs5_restore_directory/*/GS5/archives/faxes.tar.gz"
+ system "cd / && sudo /bin/tar xzfP #{restore_directory}/GS5/archives/faxes.tar.gz"
# Restore voicemails
#
- # system "cd / && tar xzfP /tmp/gs5_restore_directory/*/GS5/archives/voicemails.tar.gz"
+ # system "cd / && sudo /bin/tar xzfP #{restore_directory}/GS5/archives/voicemails.tar.gz"
# Restore the database
#
@@ -32,7 +33,7 @@ namespace :backup do
db_user = system_odbc_configuration['gemeinschaft']['USER']
db_password = system_odbc_configuration['gemeinschaft']['PASSWORD']
- system "gunzip < /tmp/gs5_restore_directory/*/GS5/databases/MySQL/gemeinschaft.sql.gz | mysql -u #{db_user} -p#{db_password} #{database}"
+ system "gunzip < #{restore_directory}/GS5/databases/MySQL/gemeinschaft.sql.gz | mysql -u #{db_user} -p#{db_password} #{database}"
FileUtils.rm_rf tmp_dir