Backup to external server

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
Post Reply
User avatar
rymax99
This is my homepage
This is my homepage
Posts: 143
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Sun Feb 02, 2014 2:08 pm
Location: Florida
Contact:

Backup to external server

Post by rymax99 »

I'm aware that NFO does not offer backup options for VDS's, but that doesn't change the need for backups.

I made a script to backup SQL (mysqldump), cron tabs, web server configuration, etc., and then ZIP it and add a time/date stamp. However, it's a pain to have to download it daily, especially because I manage a number of servers. What would be a simple way to automatically upload a ZIP file to another Linux server?

@Soja (seems I can't PM you):
soja wrote:Yeah I recently made a database and web root backup script that uses cron to run. Daily for databases, and every other day for web files. I also sync it across our 2 other VDS in Chicago and LA after all that is done, so I have 3 copies at any one time :)

Will also make a small script that deletes files over a week old.
Would you be able to share that, please?
User avatar
Edge100x
Founder
Founder
Posts: 13156
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Backup to external server

Post by Edge100x »

The easiest way to do this would be to set up SSH keys such that your first server can log in to the second server without needing a password, then use "scp" or "rsync" in your script to copy it over.

There are many pages that describe how to use SSH keys. One of them is: https://wiki.archlinux.org/index.php/SSH_Keys
User avatar
soja
This is my homepage
This is my homepage
Posts: 2389
Joined: Fri May 18, 2012 3:20 pm

Re: Backup to external server

Post by soja »

SSH keys is what I use too, but coupled with rsync over SSH.

I have the folder backups in my home directory where everything is stored on my web vds. After making the ssh keys I run this rsync command(via cron) nightly:

Code: Select all

rsync -a -e ssh user@74.91.x.x:backups/ backups
This downloads from the folder backups in my REMOTE home directory, and places the files in my local backups folder in my working directory. The trailing slash is required.

The great thing about rsync, is that it will not download the same file twice. Our backups folder is around 5GB right now, and when rsync runs it will only download new files.

To clean up backups after a week, we use this command:

Code: Select all

find backups/* -mtime +7 -exec rm {} \;
I got this method from this page: http://www.howtogeek.com/howto/ubuntu/d ... -on-linux/

Run this on test folders etc before running it on your main backups folders :)

If you need any help you can add me on steam or reply here!
Not a NFO employee
Post Reply