Jump to content

server backups with SSH


ukweb

Recommended Posts

hi there.

 

I use SSH to backup my sites which are hosted with Media Temple. i used to have a guide to follow but I misplaced it.

 

Basically I have a 'domains' directory, and a 'backup' directory. What we used to do is create a tar file in 'backup' containing the entire 'domains' directory. A quick google around has failed to give a solution that worked, and I dnt want to do any harm to my domains file

 

Does anyone know the terminal command to do what I am after? thanks Ste.

Link to comment
Share on other sites

Your entire post is a little vague really. SSH is a network protocol, you can't backup anything with it. Of course, you could backup data into an archive and then use the SSH protocol to move it to another server.

 

Anyway, I'll stop being a pain in the ass.

 

In simple terms you could simply archive whatever it is and then use scp (which copies files via the ssh protocol) to move that archive to another server.

 

DIR=/var/www
LOCATION=backup.server.com:/backups/directory
TIMESTAMP=`date +%Y-%m-%d-%H%M`
tar -czvf $TIMESTAMP.gz $DIR
scp $TIMESTAMP.gz $LOCATION
rm $TIMESTAMP.gz

 

My advice however, would be to take a look at an existing solution. rsnapshot is an awesome utility that will create incremental backups for you. Its pretty easy to configure and has heaps of features.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.