############################################## #!/bin/bash # # Make a backup from your home directory # # using tar # # and upload the files to your free webspace # ############################################## ##### clear the screen ##### clear ##### Please review these settings and change to your needs. ##### HOME=$HOME # duh BACKUPDIR=$HOME/temp # make sure temp exist SOURCE=$HOME/ # what do you want to backup ? TARGET=YOUR_FTP_SERVER # the ftp you want to put the backup on LOGIN=YOUR_LOGIN # your login for the ftp PASS=YOUR_PASS # your password for the ftp ######################################################################################## # change the --exclude to your needs # # I excluded the hidden directories # # to exclude other directories, just add --exclude=DIRECTORY_NAME # # Make sure you created the directory backup on the server first # # Please verify first the size of the backup file before uploading. # # It can be huge when you include mp3, movies..... # # For this comment the upload line with "#" # # From here, nothing needs to be changed # ######################################################################################## ### Making the directory and cleaning stuff up ### test -d $BACKUPDIR && rm $TMP -rf test -d $BACKUPDIR || mkdir -p $BACKUPDIR cd $BACKUPDIR ###### Making backup from the home directory ##### echo making backup from home directory ... tar cpf $BACKUPDIR/full-backup-home-`date '+%d-%B-%Y-%T'`.tar $SOURCE --exclude=.* > /dev/null echo done ###### Compress the files ##### echo compressing the files ... bzip2 * echo done ##### Uploading files ##### echo uploading ... /usr/bin/ncftpput -u $LOGIN -p $PASS $TARGET /backup *bz2 > /dev/null echo done ##### clean up the mess ##### echo cleaning up ... rm -f full* > /dev/null echo another Job well done echo enjoy