Commit 6efd4cb1 authored by Riccardo Padovani's avatar Riccardo Padovani

Updated scripts

parent 145c807a
......@@ -46,6 +46,6 @@ fi
# Create the backup
pg_dump "$DBNAME" > "$DIR"/today.sql
tar -xczf "$DIR"/today.tar.gz "$DIR"/today.sql
tar -cvzf "$DIR"/today.tar.gz "$DIR"/today.sql
# Remove the temp file
rm "$DIR"/today.sql
......@@ -35,6 +35,15 @@ dump_output=${2}
dropdb --if-exists "$local_db"
createdb "$local_db"
# Work in /tmp
cd /tmp
# If there is yesterday backup, then delete it
if [ -f "$dump_output" ]; then
rm -f "$dump_output"
fi
# Extract the file and import in psql
tar -xOvf "$dump_input" | psql "$local_db"
......@@ -46,5 +55,5 @@ pg_dump "$local_db" > scrubbed-db.sql
tar -cvzf "$dump_output" scrubbed-db.sql
# Removed temporary files
dropdb --if-exists "$local_db"
dropdb "$local_db"
rm -f scrubbed-db.sql
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment