Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duplicity-ftp-backup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NoCloud
duplicity-ftp-backup
Commits
358ee631
Verified
Commit
358ee631
authored
4 years ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
fixup
parent
040010a5
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
backup.sh
+3
-2
3 additions, 2 deletions
backup.sh
inc.sh
+15
-14
15 additions, 14 deletions
inc.sh
restore_file.sh
+1
-1
1 addition, 1 deletion
restore_file.sh
with
19 additions
and
17 deletions
backup.sh
+
3
−
2
View file @
358ee631
...
@@ -6,6 +6,7 @@ if [ ! -z "$1" ]; then
...
@@ -6,6 +6,7 @@ if [ ! -z "$1" ]; then
shift
shift
fi
fi
source
$DIR
/inc.sh
source
$DIR
/inc.sh
exec
&>
>(
tee
-a
"
$log_file
"
)
exit_on_fail
(){
exit_on_fail
(){
[
$1
-ne
0
]
&&
leave
$@
[
$1
-ne
0
]
&&
leave
$@
...
@@ -37,8 +38,8 @@ backup(){
...
@@ -37,8 +38,8 @@ backup(){
echo
"Creating encrypted incremental backup:
$bckplist
"
echo
"Creating encrypted incremental backup:
$bckplist
"
run_duplicity
--full-if-older-than
$BK_FULL_FREQ
\
run_duplicity
--full-if-older-than
$BK_FULL_FREQ
\
--include
${
bckplist
// / --include
}
\
--include
${
bckplist
// / --include
}
\
--exclude
/root/.cache/duplicity/
--exclude
/root/.cache/duplicity/
\
--exclude
'**'
/
ret
=
$?
ret
=
$?
if
[
-z
"
$retries
"
]
if
[
-z
"
$retries
"
]
then
then
...
...
This diff is collapsed.
Click to expand it.
inc.sh
+
15
−
14
View file @
358ee631
#!/bin/bash
#!/bin/bash
if
[
`
whoami
`
!=
"root"
]
;
then
echo
"this script must be run as root"
exit
1
fi
DIR
=
$(
realpath
$(
dirname
$0
))
DIR
=
$(
realpath
$(
dirname
$0
))
if
[
-z
"
$conf_file
"
]
;
then
if
[
-z
"
$conf_file
"
]
;
then
conf_file
=
"
$DIR
/.env"
conf_file
=
"
$DIR
/.env"
...
@@ -10,10 +15,12 @@ if [ -z "$log_file" ]; then
...
@@ -10,10 +15,12 @@ if [ -z "$log_file" ]; then
log_file
=
/var/log/bckp.log
log_file
=
/var/log/bckp.log
fi
fi
exec
&>
>(
tee
-a
"
$logfile
"
)
if
[
-z
"
$verbosity
"
]
;
then
if
[
-z
"
$verbosity
"
]
;
then
verbosity
=
"notice"
verbosity
=
"notice"
fi
remote
=
"ftp://
$user
@
$host
/
$remotedir
/"
# Exit the script and sendmail
# Exit the script and sendmail
# $1 : exit code
# $1 : exit code
...
@@ -44,11 +51,11 @@ EOF
...
@@ -44,11 +51,11 @@ EOF
run_duplicity
(){
run_duplicity
(){
export
PASSPHRASE
=
"
$encpass
"
export
PASSPHRASE
=
"
$encpass
"
export
FTP_PASSWORD
=
"
$ftppass
"
export
FTP_PASSWORD
=
"
$ftppass
"
#
set -x
set
-x
/usr/bin/duplicity
--archive-dir
/root/.cache/duplicity/
$archive_dir
--verbosity
$verbosity
\
/usr/bin/duplicity
--verbosity
$verbosity
\
$@
\
$@
\
$remote
$remote
#
set +x
set
+x
unset
PASSPHRASE
unset
PASSPHRASE
unset
FTP_PASSWORD
unset
FTP_PASSWORD
}
}
...
@@ -69,9 +76,3 @@ collection_state() {
...
@@ -69,9 +76,3 @@ collection_state() {
echo
"Backups state"
echo
"Backups state"
run_duplicity collection-status
run_duplicity collection-status
}
}
if
[
`
whoami
`
!=
"root"
]
then
echo
"this script must be run as root"
exit
1
fi
This diff is collapsed.
Click to expand it.
restore_file.sh
+
1
−
1
View file @
358ee631
...
@@ -36,7 +36,7 @@ source $DIR/inc.sh
...
@@ -36,7 +36,7 @@ source $DIR/inc.sh
export
PASSPHRASE
=
"
$encpass
"
export
PASSPHRASE
=
"
$encpass
"
export
FTP_PASSWORD
=
"
$ftppass
"
export
FTP_PASSWORD
=
"
$ftppass
"
/usr/bin/duplicity
--archive-dir
$archive_dir
--verbosity
$verbosity
--file-to-restore
$delay
"
$restore_path
"
ftp://
$user
@
$host
/
$remote
dir
/
"
$destination_path
"
/usr/bin/duplicity
--verbosity
$verbosity
--file-to-restore
$delay
"
$restore_path
"
$remote
"
$destination_path
"
unset
PASSPHRASE
unset
PASSPHRASE
unset
FTP_PASSWORD
unset
FTP_PASSWORD
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment