A very effective way for backing up your data on a Linux server is to set a cron job on your box to mail your data to your GMail account. GMail servers are very reliable and give you a huge amount of space for free. so they are pretty suitable for backing up sensitive data.
In order to accomplish this , first create a directory named “backup” in the root directory of your box :
cd / && mkdir backup
then you need to create a script to do the backup and mail it for you.
copy and paste the following into the file :
cd /backup rm -rf /backup/* cp LIST_OF_FILES . tar jcf backup.tar.bz2 * echo | mutt -a backup.tar.bz2 -s "my daily backup" -- firstname.lastname@example.org
you have to change LIST_OF_FILES string to the list of the files you want to be backed up separated by space , and change email@example.com to your own gmail account.
as you can see in the script we are compressing the data files to make them as small as possible.
also we are using “mutt” to send emails so you need to install it , in Debian you can install it by following command :
apt-get install mutt
make the script executable :
chmod +x /usr/bin/backup
lastly you need to set a cron job , so open the cron file by following command :
and copy and paste the following command into it :
0 0 * * * /usr/bin/backup
it will run your backup script once daily 🙂
also don’t forget you need to have a working smtp server on your Linux box.