Ronan0's picture

I have TKLBAM backing up a MySQL database once a day.

But I also use MySQL binary logs to enable recovery of database transactions made since the last tklbam backup occurred.

I would like to be able to automatically delete the previous day's binary log files once TKLBAM has confirmed a successful backup has occurred.

How might I do that?

In the tklbam-backup file in etc/cron.daily after 'tklbam-backup --quiet' is run, is there a way to pickup the confirmation that tklbam has successfully finished its operation, so that on that signal I can proceed to delete the now obsolete MySQL binary log files?

Any input appreciated. Thanks.

Jeremy Davis's picture

TKLBAM has a facility to do any number of additional, pre and post, backup and restore operations. That is handled by the tklbam-hooks mechanism.

You'll find the doc page here.

Essentially, you need to write a script (which goes in /etc/tklbam/hooks.d) which accepts 2 arguments an "operation" ('backup'/'restore') and a "state" ('pre'/'post').

There is an example hook: /etc/tklbam/hooks.d/example

I suggest that you enable that ('chmod +x /etc/tklbam/hooks.d/example') and have a bit of a play.

Add new comment