LFTP – Backup website over FTP

LinuxI was facing task how to schedule an automatic backup/mirror of a website which allows connecting over FTP. PHP command exec was forbidden by the provider so it was not possible to run OS commands. PHP script execution time was set to quite short time so it was neither possible to zip using PHP functions and send the whole backup file somewhere easily.

I was looking for another option how I can backup/mirror the website and found a pretty tool called LFTP. It allows connectiong with quite many protocols, including FTP.

So I tried and it worked 🙂

The command I have setup in my CRON is like the following:

lftp -u username,password -e "set ftp:ssl-allow no; mirror -c www/ /var/www; quit" ftp.mysite.com

Leave a Reply