A2 Hosting Forums

Full Version: How to backup selected directories?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am really new to Linux and server management, so please be gentle Smile

I am setting up an authentication server that uses php and postgresql, and at each step I am afraid of breaking something...

So I would like to be able to create backups regularly for particular directories in my vps, and be able to restore when the inevitable screwup occurs.

So, please explain the best way to accomplish this on my vps? Is it done automatically already? Should I just tar the directories to a backup area on the local machine? Can I set up Bacula?

Any reccommendations gratefully received!

Jeff Schallenberg

jschall Wrote:
I am really new to Linux and server management, so please be gentle Smile


*BUMP*

Anybody out there?

- Jeff Schallenberg

I would recommend using a simple script for backing up directories.  You could have them run automatically by using cron.  While I can't outline how to use all of these features, I will try to make this as simple as possible per your request :-)

from shell, create a file called "backup.sh"

in the file put:

#!/bin/bash

tar -cvpzf /path/to/backup/directory/backupfile.tar.gz /path/to/directory/you/want/to/backup/*

ex. tar -cvpzf /backups/folderbackup.tar.gz /public_html/myapplication/*

Save the file and make it executable "chmod 755 backup.sh"  either run this file from the location you placed it "./backup.sh" or you can place the file in one of the cron folders (cron.daily, cron.weekly, etc.) usually in /etc/cron.daily etc,

I would read up on using tar and cron as these two untilities combined can make your folder backups easy and automated.  Also, you will need to know how to use tar to uncompress the files should you need to restore them.

Hope that helps!

jmiller Wrote:
I would recommend using a simple script for backing up directories...  
I would read up on using tar and cron as these two untilities combined can make your folder backups easy and automated.  


Thanks, for the tips, Jeremy! I will give them a try!

- Jeff

Reference URL's