Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Nuovo sito - PHP
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
37
Issues
37
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Nuovo sito - PHP
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
Hide 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}
DBNAME
=
${
2
}
# Check if the directory exists, if not, create it
if
[
!
-d
$DIR
]
;
then
mkdir
$DIR
if
[
!
-d
"
$DIR
"
]
;
then
mkdir
"
$DIR
"
fi
# If there is yesterday backup, then delete it
if
[
-f
$DIR
/yesterday.tar.gz
]
;
then
rm
-f
$DIR
/yesterday.tar.gz
if
[
-f
"
$DIR
"
/yesterday.tar.gz
]
;
then
rm
-f
"
$DIR
"
/yesterday.tar.gz
fi
# If there is a backup of today, move it to yesterday
if
[
-f
$DIR
/today.tar.gz
]
;
then
mv
$DIR
/today.tar.gz
$DIR
/yesterday.tar.gz
if
[
-f
"
$DIR
"
/today.tar.gz
]
;
then
mv
"
$DIR
"
/today.tar.gz
"
$DIR
"
/yesterday.tar.gz
fi
# Create the backup
pg_dump
$DBNAME
>
$DIR
/today.sql
tar
-xczf
$DIR
/today.tar.gz
$DIR
/today.sql
pg_dump
"
$DBNAME
"
>
"
$DIR
"
/today.sql
tar
-xczf
"
$DIR
"
/today.tar.gz
"
$DIR
"
/today.sql
# 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