[noosfero/noosfero][master] 2 commits: Fix backup task
Antonio Terceiro
gitlab at gitlab.com
Fri May 8 15:55:44 BRT 2015
Antonio Terceiro pushed to branch master at Noosfero / noosfero
Commits:
3b814b25 by Athos Ribeiro at 2015-05-08T15:25:52Z
Fix backup task
- Adds host option to the postgres commands where necessary.
- Passes -h option to tar when compressing in order to follow symlinks.
Signed-off-by: Athos Ribeiro <athoscribeiro at gmail.com>
Signed-off-by: Lucas Kanashiro <kanashiro.duarte at gmail.com>
- - - - -
12d04695 by Antonio Terceiro at 2015-05-08T18:55:35Z
Merge branch 'fix_backup_task' into 'master'
Fix backup task
- Adds host option to the postgres commands where necessary.
- Passes -h option to tar when compressing in order to follow symlinks.
Signed-off-by: Athos Ribeiro <athoscribeiro at gmail.com>
Signed-off-by: Lucas Kanashiro <kanashiro.duarte at gmail.com>
See merge request !567
- - - - -
1 changed file:
- lib/tasks/backup.rake
Changes:
=====================================
lib/tasks/backup.rake
=====================================
--- 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
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/85b736c87855217fc9d6d133f17d8d35184301fa...12d046950b8577db431ab112183cfe0ed51ffc6f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150508/cf208783/attachment.html>
More information about the Noosfero-dev
mailing list