Skip to content

Instantly share code, notes, and snippets.

@feralhosting feralhosting/lftp-new.sh
Last active Aug 29, 2015

Embed
What would you like to do?
LFTP - Automated sync from seedbox to home SFTP script with generic name
#!/bin/bash
login="username"
pass="password"
host="server.feralhosting.com"
remote_dir="/folder/you/want/to/copy"
local_dir="/cygdrive/s/lftp/somefolder/where/you.want/your/files/"
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 1
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 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.