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
https://forums.phpfreaks.com/topic/194253-server-backups-with-ssh/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.