[ubuntu-za] MySQL backup
Xandor Schiefer
me at xandor.co.za
Mon Oct 12 11:03:02 UTC 2015
I did a quick search and found this in a gist
(https://gist.github.com/yanbab/7722991):
# Sample anacrontab usage on Gandi Simple hosting
#
# Does a daily mysql backup and delete 1 week old backups
#
# SFTP : lamp0/etc/cron/anacron/anacrontab
# SSH : /srv/data/etc/cron/anacron/anacrontab
@daily 0 mysql_backup mkdir /srv/data/tmp/mysql_backup ; mysqldump -h
localhost -u root {-pPASSWORD} --all-databases >
/srv/data/tmp/mysql_backup/`date '+%F'`.databases.sql ; rm
/srv/data/tmp/mysql_backup/`date '+%F' --date '
Sure you could adjust it to your needs
Kind regards,
Xandor Schiefer
079 706 5620
This communication may be unlawfully collected and stored by the
National Security Agency (NSA) and other organizations in secret. The
parties to this email do not consent to the retrieving or storing of
this communication and any related metadata, as well as printing,
copying, re-transmitting, disseminating, or otherwise using it. If you
believe you have received this communication in error, please delete
it immediately.
On 12/10/2015 12:58, Alfred Charles Stockton wrote:
> I would use anacron rather than cron just in case system is down when cron
> is supposed to execute dackup.Unless, of course, Zambian electricity is
> more reliable than Eskom.
> I would use the date and time as part of the backup name and then you can
> have a script, running from anacron again, that deletes backups older than
> a particular date.
>> Hi Guys
>>
>> Sorry for asking for this on the list, but I'm in Zambia again and only
>> only have access to email (no Internet access). Otherwise I would have
>> searched for a solution myself.
>>
>> I have an Ubuntu 14.04 server running a MySQL server for which I want to
>> do daily backups. The server is only busy from 6am to about 10pm. So
>> I'm considering a simple cron job that runs mysqldump at midnight. But
>> I have a few questions:
>>
>> a. Is this a good way to do it? Or is there something beter?
>>
>> b. If I use cron:
>> b.1 how do I generate unique file names for the backups?
>> e.g. [db_name][date]
>> b.2 how do I delete old versions so I don't fill up the hard drive?
>> e.g. keeping only backups for two weeks, and once a month
>> thereafter.
>>
>> Thanks
>> Charl
>>
>> --
>> ubuntu-za mailing list
>> ubuntu-za at lists.ubuntu.com
>> https://lists.ubuntu.com/mailman/listinfo/ubuntu-za
>>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-za/attachments/20151012/10b0bc68/attachment.pgp>
More information about the ubuntu-za
mailing list