Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
18a90734
Commit
18a90734
authored
Feb 11, 2017
by
David Kerr
Browse files
Alternate backup cleanup after 180 days method.
parent
a4b2cebe
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/ssh.sh
View file @
18a90734
...
...
@@ -75,7 +75,7 @@ ssh_deploy() {
fi
# BACKUP is optional. If not provided then default to yes
if
[
"
$ACME_DEPLOY_SSH_BACKUP
"
=
"no"
]
;
then
if
[
"
$ACME_DEPLOY_SSH_BACKUP
"
=
"no"
]
;
then
Le_Deploy_ssh_backup
=
"no"
elif
[
-z
"
$Le_Deploy_ssh_backup
"
]
;
then
Le_Deploy_ssh_backup
=
"yes"
...
...
@@ -178,8 +178,12 @@ ssh_deploy() {
_err
"No remote commands to excute. Failed to deploy certificates to remote server"
return
1
elif
[
"
$Le_Deploy_ssh_backup
"
=
"yes"
]
;
then
# run cleanup on the backup directory, erase all older than 180 days.
_cmdstr
=
"find
$_backupprefix
* -type d -mtime +180 2>/dev/null | xargs rm -rf ;
$_cmdstr
"
# run cleanup on the backup directory, erase all older
# than 180 days (15552000 seconds).
_cmdstr
=
"{ now=
\"\$
(date -u +%s)
\"
; for fn in
$_backupprefix
*;
\
do if [ -d
\"\$
fn
\"
] && [
\"\$
(expr
\$
now -
\$
(date -ur
\$
fn +%s) )
\"
-ge
\"
15552000
\"
];
\
then rm -rf
\"\$
fn
\"
; echo
\"
Backup
\$
fn deleted as older than 180 days
\"
; fi; done; };
$_cmdstr
"
# Alternate version of above... _cmdstr="find $_backupprefix* -type d -mtime +180 2>/dev/null | xargs rm -rf ; $_cmdstr"
# Create our backup directory for overwritten cert files.
_cmdstr
=
"mkdir -p
$_backupdir
;
$_cmdstr
"
_info
"Backup of old certificate files will be placed in remote directory
$_backupdir
"
...
...
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