I'd like to backup several directories into one tar archive using a cronjob, and also tar a mysql dump for easier downloading. Then if it doesn't get too complicated have some of these emailed to me. I know a script would be necessary for the emailing (?) but some of the FAQs I've read assume prior knowledge and it's difficult tracking down a straight answer. So over to you guys.
Currently I backup the database with this cronjob:
mysqldump --add-drop-table -uroot -ppassword database_name > /home/site/public_html/backup_database.txt
I haven't set this up yet, but will the following tar command work, or do I need to remove "/backup_database.txt" from the end?
tar czpf /home/site/public_html/backup_database.gz /home/site/cgi-bin/program/data/backup_database.txt
I'm using a dedicated Linux server, Redhat 6.2. Does someone have a script or point me in the right direction to then set up a cronjob that will email backup_database.gz to me?
I use this cron to tar a directory:
tar czpf /home/site/public_html/backup_data.gz /home/site/cgi-bin/program/data
If I want to add ../program/data2 and ../program/dir/dir2/data3 into the same archive, backup_data.gz, do I just add these pathnames at the end?
I had the question answered elsewhere on restoring data from a tar, but these were directions for restoring information from a single directory ("cd /path/to/data/.. # one directory behind data ... tar xzpf backup_data.tar.gz"). Would this restore method need to be changed if I had several directories all backed up into the one tar?
When restoring from a tar I would have probably already have had to re-install GMail and GForum. Will the tar overwrite any default data GMail/Forum has set up?
I would greatly appreciate any help in answering these questions.
Jason
Currently I backup the database with this cronjob:
mysqldump --add-drop-table -uroot -ppassword database_name > /home/site/public_html/backup_database.txt
I haven't set this up yet, but will the following tar command work, or do I need to remove "/backup_database.txt" from the end?
tar czpf /home/site/public_html/backup_database.gz /home/site/cgi-bin/program/data/backup_database.txt
I'm using a dedicated Linux server, Redhat 6.2. Does someone have a script or point me in the right direction to then set up a cronjob that will email backup_database.gz to me?
I use this cron to tar a directory:
tar czpf /home/site/public_html/backup_data.gz /home/site/cgi-bin/program/data
If I want to add ../program/data2 and ../program/dir/dir2/data3 into the same archive, backup_data.gz, do I just add these pathnames at the end?
I had the question answered elsewhere on restoring data from a tar, but these were directions for restoring information from a single directory ("cd /path/to/data/.. # one directory behind data ... tar xzpf backup_data.tar.gz"). Would this restore method need to be changed if I had several directories all backed up into the one tar?
When restoring from a tar I would have probably already have had to re-install GMail and GForum. Will the tar overwrite any default data GMail/Forum has set up?
I would greatly appreciate any help in answering these questions.
Jason