10-03-2016, 04:34 AM
I am trying to configure lftp to automatically download files from a server. I added lftp via the unofficial add ons.
I'm using the following script. It runs fine when I run it from my mac but when I run it from within openelec I get an error message: mirror: Login failed: 530 Login incorrect.
I know that my credentials are right though because I can use them to connect if i do lftp usernam@server and enter my password. can anyone help? thank you.
I'm using the following script. It runs fine when I run it from my mac but when I run it from within openelec I get an error message: mirror: Login failed: 530 Login incorrect.
I know that my credentials are right though because I can use them to connect if i do lftp usernam@server and enter my password. can anyone help? thank you.
Code:
#!/bin/bash
login="username"
pass="password"
host="host.iamconneting.to"
remote_dir='~/folder/you/want/to/copy'
local_dir="$HOME/lftp/"
base_name="$(basename "$0")"
lock_file="/tmp/$base_name.lock"
trap "rm -f $lock_file" SIGINT SIGTERM
if [ -e "$lock_file" ]
then
echo "$base_name is running already."
exit
else
touch "$lock_file"
lftp -u $login,$pass $host << EOF
set ftp:ssl-allow no
set mirror:use-pget-n 5
mirror -c -P5 --log="/var/log/$base_name.log" "$remote_dir" "$local_dir"
quit
EOF
rm -f "$lock_file"
trap - SIGINT SIGTERM
exit
fi