TurnKey Linux Virtual Appliance Library

file created with hook script not included in tklbam-backup

Hi,

I am pretty new to TurnKey. I have discovered the use of hook scripts for doing backup/restore procedures.

I am using Percona DB server on a TK Core instance and I have created a pre-backup hook script which uses innobackupex utility (part of Percona) to backup all the databases. However, when running tklbam-backup, the hook script runs, creates the backup file, but the file is not included in the actual backup.

Running another tklbam-backup script will include the old backup file, but again, the one created with the second backup hook script will not be included. 

Does anybody knows how can I make the tklbam-backup to include the archive file created with the pre-backup hook script in the same backup of the system ?

I was thinking to this as a workaround : rename /usr/bin/tklbam-backup to something else. Create a new file called : /usr/bin/tklbam-backup, where I will put first the contents of the pre-backup hook script and then run the renamed tklbam-backup script.

Please let me know if there is any other way to accomplish this. 

Thank you.

Jeremy's picture

My suspicion...

My suspicion is that it starts dumping the database before the backup takes place but when it checks for files the dump isn't yet created (hasn't finished) so does not get included. I have had a simlar (but different problem) with TKLPatches that import large DBs - the patching process was failing because the import hadn't finished before the patch was otherwise ready to close.

The workaround I used was to import the DB earlier in my script but I suspect that won't work for you (because I imagine that your script is just dumping the DB - nothing else...)

So I can think of 2 workarounds. One would be to just create a cron job to dump the DB a couple of minutes before TKLBAM runs (which I imagine should work). The other would be to test my theory and make the script wait until the dump is complete prior to continuing (and launching TKLBAM). Personally that is what I initially tried with my TKLPatch but couldn't get it to wait for MySQL (not sure why - I tried a number of different commands which should have worked IMO - but no joy).

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)