<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 09/21/2015 02:48 PM, Jerome Yuzyk
      wrote:<br>
    </div>
    <blockquote cite="mid:15692306.sU2fufnCGt@desk" type="cite">
      <pre wrap="">I've used optimize_mythdb.pl regularly for a long time without much regard for the database being busy, because it never did more than check the DB and fortunately never found anything to repair, so it was pretty much a read-only operation.

But the latest version in 0.27.5 will defragment seektables and that means writing the DB for sure.

How will this behave while recordings are being made, processed, or watched?

Will MySQL just handle the table-locking automagically? I suspect not.

So, I think I need to find or write something that asks if the front- and backend is or will be quiet for the next N minutes, before optimizing. 

Has anyone done this already? Creative uses of MythWelcome?

</pre>
    </blockquote>
    My solution to this - <br>
    I always run this from the script that is called from "Pre Shutdown
    check-command" (mythtv-setup, General, Shutdown/Wakeup Options). At
    this point mythtv is ready to shut down, so nothing is recording in
    the near future. My script also checks the date and makes sure the
    DB reorg is only run once a week, since that script is called every
    time you shut down. <span style="color: rgb(0, 0, 0); font-family:
      sans-serif; font-size: 12.6999998092651px; font-style: normal;
      font-variant: normal; font-weight: normal; letter-spacing: normal;
      line-height: 19.0499992370605px; orphans: auto; text-align: start;
      text-indent: 0px; text-transform: none; white-space: normal;
      widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
      display: inline !important; float: none; background-color:
      rgb(249, 249, 249);"></span><br>
    <br>
    Peter<br>
    <br>
  </body>
</html>