[UPHPU] backup script
Lonnie Olson
fungus at aros.net
Mon Aug 21 11:37:56 MDT 2006
On Aug 10, 2006, at 5:55 PM, Timothy Humphrey wrote:
> Alright! Alright! I give. You guys got me. So let me back this
> whole truck up and start over...
>
> My question is now: What automatic backup system would you all
> recommend?
It sounds like your goal is to get a MySQL database backed up to your
laptop. Is this correct?
This type of backup can be done in a simple shell script, no PHP
necessary. It happens in two steps.
STEP 1 - backup your databases
1. Use `mysqldump` to get the database dump
2. gzip or bzip2 it
3. store it in a file on the local server
a. optionally keep old copies for a while
STEP 2 - take a backup offsite (laptop)
1. run an rsync, scp, rsnapshot, etc on your laptop to retrieve the
file from the server.
2. schedule this as a cron job on your laptop to run when you are
usually using your laptop.
Example:
--server script--
for db in "mysql test otherdb webapp wordpress dbetc"
do
mysqldump -u root $db | gzip > /backup/sql/$db.`date +%F`.sql.gz
done
--laptop script--
rsync -a server:/backup/sql/ /backup/sql/
Of course you may want to tweak this to your own needs.
--lonnie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2593 bytes
Desc: not available
Url : http://uphpu.org/pipermail/uphpu/attachments/20060821/4550a29d/smime.bin
More information about the UPHPU
mailing list