Pages

25 April 2011

ftpbackup

This is a shell script I use to backup my home folder to a remote server. It uses lftp and it was written using a here document.

I got the inspiration from an article at linux.com and I improved it

I must tell you that this script is used to upload data to a remote directory but it also erases everything contained there. Do not use the -e option if you do not wish to delete anything.

# Script to backup an entire /home/< user > directory with lftp. Neat and clean. No sweat.

# Simply replace < whatever > with your own data. That's it.

###### BE WARNED!!! Option -e erases all the data on the target directory########

######DO NOT USE IT if you want to keep all the data there####################

 #!/bin/bash

 lftp << EOF > /dev/null 2>&1

 open -u < username >,< password > -p 21 < serveraddress >

 mirror -c -e -R /home/< user > < /path/to/remotedirectory >

 exit

EOF