Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

Backing up and emailing backups

Quote Reply
Backing up and emailing backups
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
Quote Reply
Re: [wickedmoon] Backing up and emailing backups In reply to
Hello Jason!

In the last years I have seen hundreds of such questions on MySQL Database and how to.

Perhaphs it makes sense to suggest GT to may be also make a seperate forum on mysql parallel to perl and cgis.
Quote Reply
Re: [wickedmoon] Backing up and emailing backups In reply to
Any help with this?

Jason
Quote Reply
Re: [wickedmoon] Backing up and emailing backups In reply to
>>
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
<<

Yep it should work fine.

>>
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?
<<

Use MIME::Lite if you have access to it. Really easy.

>>
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?
<<

Yep.

Eg....

tar czpf /path/to/file.gz /path/one/* /path/two/*

Last edited by:

RedRum: Feb 1, 2002, 4:33 PM