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
Fjen Undso
myftpdumper
Commits
80d544c4
Commit
80d544c4
authored
May 10, 2017
by
Fjen Undso
Browse files
Merge branch 'sftp-keyfile' into 'master'
lftp: Use specific key file See merge request
!1
parents
6dfb4b19
c8e0b285
Changes
1
Hide whitespace changes
Inline
Side-by-side
myftpdumper.sh
100644 → 100755
View file @
80d544c4
...
...
@@ -39,6 +39,7 @@ declare -r FTP_HOST=""
declare
-r
FTP_USER
=
""
declare
-r
FTP_PASS
=
""
# if empty, ssh key with no password is required
declare
-r
FTP_PORT
=
""
# empty for default
declare
-r
FTP_KEYFILE
=
""
# ssh key for sftp, empty for default
declare
-r
FTP_DIR
=
""
declare
-r
FTP_NUMBACKUPS
=
90
...
...
@@ -239,11 +240,15 @@ encryption() {
}
exec_ftp
()
{
if
[[
-n
"
$FTP_PORT
"
]]
;
then
lftp
-p
$FTP_PORT
-u
$FTP_USER
,
$FTP_PASS
$FTP_TYPE
://
$FTP_HOST
-e
"
$1
"
2> /dev/null
else
lftp
-u
$FTP_USER
,
$FTP_PASS
$FTP_TYPE
://
$FTP_HOST
-e
"
$1
"
2> /dev/null
fi
local
lftp_port
local
lftp_con_prog
[[
-n
"
$FTP_PORT
"
]]
\
&&
lftp_port
=
"-p
$FTP_PORT
"
[[
-n
"
$FTP_KEYFILE
"
]]
\
&&
lftp_con_prog
=
"set sftp:connect-program
\"
ssh -a -x -i
$FTP_KEYFILE
\"
"
lftp
-c
"
$lftp_con_prog
; set net:max-retries 3; open
$lftp_port
-u
$FTP_USER
,
$FTP_PASS
$FTP_TYPE
://
$FTP_HOST
;
$1
"
2> /dev/null
[[
$?
-ne
0
]]
\
&&
error
"Failed to execute command on remote server:
$1
"
}
...
...
@@ -251,7 +256,7 @@ exec_ftp() {
upload
()
{
if
wants_upload
;
then
# FTP: directory creation
ftpmkdir
=
$(
exec_ftp
"mkdir -p
\"
$FTP_DIR
/
$date
\"
; exit"
)
exec_ftp
"mkdir -p
\"
$FTP_DIR
/
$date
\"
; exit"
# FTP: delete old backups
info
"Delete old backups on FTP..."
...
...
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