Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Felix Eckhofer
tools
Commits
7798af2f
Commit
7798af2f
authored
Jul 17, 2013
by
Felix Eckhofer
🤹🏼
Browse files
add duply-do-backup.sh
parent
bdb8cd7b
Changes
1
Show whitespace changes
Inline
Side-by-side
scripts/duply-do-backup.sh
0 → 100644
View file @
7798af2f
#!/bin/bash
# ################################################# #
# duply-do-backup #
# #
# this script is meant to be called from cron and #
# first starts a backup and then a purge using #
# duply. it will not generate any output if all #
# works smoothly. if anything goes wrong, the #
# full log is displayed. #
# felix@eckhofer.com #
# ################################################# #
LOGFILE
=
"
`
mktemp
`
"
PROFILE
=
"
$1
"
PROFILEPATH
=
"/etc/duply/
$PROFILE
"
export
RSYNC_RSH
=
'ssh -oBatchMode=yes -oLogLevel=Error'
# avoid printing ssh banner
function
exit_error
()
{
[
-z
"
$@
"
]
||
echo
"
$@
"
rm
-f
"
$LOGFILE
"
exit
1
}
if
[
-z
"
$PROFILE
"
]
;
then
exit_error
"usage:
`
basename
$0
`
backup-profile"
fi
if
[
!
-d
"
$PROFILEPATH
"
]
;
then
exit_error
"profile not found."
fi
echo
"### Backing up ###"
>>
"
$LOGFILE
"
if
!
duply
"
$PROFILE
"
backup
>>
"
$LOGFILE
"
then
cat
"
$LOGFILE
"
exit_error
fi
echo
"### Cleaning up ###"
>>
"
$LOGFILE
"
if
!
duply
"
$PROFILE
"
purge-full
--force
>>
"
$LOGFILE
"
then
cat
"
$LOGFILE
"
exit_error
fi
rm
"
$LOGFILE
"
Write
Preview
Supports
Markdown
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