Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
www-test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Silvia Bindelli
www-test
Commits
5b026e3a
Commit
5b026e3a
authored
Jul 14, 2014
by
Riccardo Padovani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Double quote vars to prevent globbing and word splitting. Thanks to mapreri
parent
35ad27fc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
scripts/backup.sh
scripts/backup.sh
+9
-9
No files found.
scripts/backup.sh
View file @
5b026e3a
...
@@ -30,22 +30,22 @@ DIR=${1}
...
@@ -30,22 +30,22 @@ DIR=${1}
DBNAME
=
${
2
}
DBNAME
=
${
2
}
# Check if the directory exists, if not, create it
# Check if the directory exists, if not, create it
if
[
!
-d
$DIR
]
;
then
if
[
!
-d
"
$DIR
"
]
;
then
mkdir
$DIR
mkdir
"
$DIR
"
fi
fi
# If there is yesterday backup, then delete it
# If there is yesterday backup, then delete it
if
[
-f
$DIR
/yesterday.tar.gz
]
;
then
if
[
-f
"
$DIR
"
/yesterday.tar.gz
]
;
then
rm
-f
$DIR
/yesterday.tar.gz
rm
-f
"
$DIR
"
/yesterday.tar.gz
fi
fi
# If there is a backup of today, move it to yesterday
# If there is a backup of today, move it to yesterday
if
[
-f
$DIR
/today.tar.gz
]
;
then
if
[
-f
"
$DIR
"
/today.tar.gz
]
;
then
mv
$DIR
/today.tar.gz
$DIR
/yesterday.tar.gz
mv
"
$DIR
"
/today.tar.gz
"
$DIR
"
/yesterday.tar.gz
fi
fi
# Create the backup
# Create the backup
pg_dump
$DBNAME
>
$DIR
/today.sql
pg_dump
"
$DBNAME
"
>
"
$DIR
"
/today.sql
tar
-xczf
$DIR
/today.tar.gz
$DIR
/today.sql
tar
-xczf
"
$DIR
"
/today.tar.gz
"
$DIR
"
/today.sql
# Remove the temp file
# Remove the temp file
rm
$DIR
/today.sql
rm
"
$DIR
"
/today.sql
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment