From 3b814b256441be6e0fc98cb1afa695c4f13d6849 Mon Sep 17 00:00:00 2001 From: Athos Ribeiro Date: Fri, 8 May 2015 15:13:40 -0300 Subject: [PATCH] Fix backup task --- lib/tasks/backup.rake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake index 7e64d17..14b2418 100644 --- a/lib/tasks/backup.rake +++ b/lib/tasks/backup.rake @@ -25,9 +25,10 @@ task :backup => :check_backup_support do dump = File.join('tmp/backup', backup_name) + '.sql' database = $config['production']['database'] - sh "pg_dump #{database} > #{dump}" + host = $config['production']['host'] + sh "pg_dump -h #{host} #{database} > #{dump}" - sh 'tar', 'caf', backup_file, dump, *dirs + sh 'tar', 'chaf', backup_file, dump, *dirs rm_f dump puts "****************************************************" @@ -81,14 +82,15 @@ task :restore => :check_backup_support do database = $config['production']['database'] username = $config['production']['username'] + host = $config['production']['host'] puts "WARNING: backups should be restored to an empty database, otherwise" puts "data from the backup may not be loaded properly." puts puts 'You can remove the existing database and create a new one with:' puts - puts "$ sudo -u postgres dropdb #{database}" - puts "$ sudo -u postgres createdb #{database} --owner #{username}" + puts "$ sudo -u postgres dropdb -h #{host} #{database}" + puts "$ sudo -u postgres createdb -h #{host} #{database} --owner #{username}" puts print "Are you sure you want to continue (y/N)? " response = $stdin.gets.strip -- libgit2 0.21.2