Script to sync files with two servers via lftp with mirror

Can some share some light, I am trying to “Sync” files automatically from my VPS with another server via lftp. I have searched online and have found a script that will sync every so often and this is done in conjunction with a cron job.

Now, the script was created to sync server to local and all files, I want it local to the server (upload instead of download) and a specific type of file (by extension) and to ignore all other files. I have tried it and I can’t get it to work. This is the command I tried but does not work:


echo Sync started …

lftp -f "
open $HOST
user $USER $PASS
mirror --reverse --verbose --exclude *.jpg --exclude *.png $SOURCEFOLDER $TARGETFOLDER
Can someone with the right knowledge help me with this?

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki