<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Jon,<br>
    <br>
    Here's the cron line:<br>
    <br>
    <br>
    # purge 90 day old reports<br>
    0 01 * * * psql  < purge_reports.sql >/dev/null 2>&1<br>
    <br>
    And the contents of purge_reports.sql:<br>
    <br>
    BEGIN;<br>
    <br>
    DELETE FROM reporter.schedule WHERE run_time<NOW()-INTERVAL '90
    days';<br>
    DELETE  FROM reporter.report WHERE create_time<NOW()-INTERVAL '90
    days' AND recur=FALSE AND id NOT IN<br>
    (SELECT r.id FROM reporter.report r INNER JOIN reporter.schedule s
    ON r.id=s.report);<br>
    <br>
    COMMIT;<br>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-Blake-
Conducting Magic
Will consume any data format
MOBIUS

</pre>
    <div class="moz-cite-prefix">On 5/28/2024 1:45 PM, Murphy, Benjamin
      via Evergreen-general wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:DM6PR09MB57997C93DE219D2C7D39198FBFF12@DM6PR09MB5799.namprd09.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
        NC Cardinal has a process that deletes old output and
        non-recurring reports after 3 months. We don't touch the
        templates. (Its a cron job that Mobius runs for us.)</div>
      <div id="Signature">
        <p><span style="color: black;"> </span></p>
        <p><span
style="font-family: Arial, sans-serif; font-size: 10pt; color: black;"><b>Benjamin
              Murphy</b></span></p>
        <p><span
style="font-family: Arial, sans-serif; font-size: 10pt; color: black;">NC
            Cardinal Program Manager</span></p>
        <p><span
style="font-family: Arial, sans-serif; font-size: 10pt; color: black;">State
            Library of North Carolina</span></p>
        <p><span
style="font-family: Arial, sans-serif; font-size: 10pt; color: rgb(5, 99, 193);"><u><a class="moz-txt-link-abbreviated" href="mailto:benjamin.murphy@dncr.nc.gov">benjamin.murphy@dncr.nc.gov</a>
            </u></span><span
style="font-family: Arial, sans-serif; font-size: 10pt; color: black;"> |
            <a
href="https://statelibrary.ncdcr.gov/services-libraries/nc-cardinal"
              style="margin-top: 0px; margin-bottom: 0px;"
              moz-do-not-send="true" class="moz-txt-link-freetext">
https://statelibrary.ncdcr.gov/services-libraries/nc-cardinal</a></span></p>
        <p><span
style="font-family: Arial, sans-serif; font-size: 10pt; color: black;">109
            East Jones Street  | 4640 Mail Service Center </span></p>
        <p><span
style="font-family: Arial, sans-serif; font-size: 10pt; color: black;">Raleigh,
            North Carolina 27699-4600</span></p>
        <p style="margin-top: 6pt;"><span
            style="font-family: Arial, sans-serif; font-size: 10pt;">The
            State Library is part of the NC Department of Natural &
            Cultural Resources.</span></p>
        <p><span
style="font-family: Arial, sans-serif; font-size: 10pt; color: black;"><i>Email
              correspondence to and from this address is subject to the
              North Carolina Public Records Law and may be disclosed to
              third parties.</i></span></p>
        <p style="margin-bottom: 12pt;"><span
            style="background-color: rgb(255, 255, 0);">Please note new
            email address</span></p>
        <p> </p>
      </div>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          face="Calibri, sans-serif" color="#000000"><b>From:</b>
          Evergreen-general
          <a class="moz-txt-link-rfc2396E" href="mailto:evergreen-general-bounces@list.evergreen-ils.org"><evergreen-general-bounces@list.evergreen-ils.org></a> on
          behalf of JonGeorg SageLibrary via Evergreen-general
          <a class="moz-txt-link-rfc2396E" href="mailto:evergreen-general@list.evergreen-ils.org"><evergreen-general@list.evergreen-ils.org></a><br>
          <b>Sent:</b> Tuesday, May 28, 2024 2:35 PM<br>
          <b>To:</b> Evergreen Discussion Group
          <a class="moz-txt-link-rfc2396E" href="mailto:evergreen-general@list.evergreen-ils.org"><evergreen-general@list.evergreen-ils.org></a><br>
          <b>Cc:</b> JonGeorg SageLibrary
          <a class="moz-txt-link-rfc2396E" href="mailto:jongeorg.sagelibrary@gmail.com"><jongeorg.sagelibrary@gmail.com></a><br>
          <b>Subject:</b> [External] [Evergreen-general] Reporter folder
          cleanup question</font>
        <div> </div>
      </div>
      <div>
        <div
style="background-color:#FFEB9C; width:100%; border-style:solid; border-color:#9C6500; border-width:1pt; padding:2pt; font-size:10pt; line-height:12pt; font-family:'Calibri'; color:black; text-align:left">
          <span style="color:#FF0000; font-weight:bold">CAUTION:</span>
          External email. Do not click links or open attachments unless
          verified. Report suspicious emails with the Report Message
          button located on your Outlook menu bar on the Home tab.</div>
        <br>
        <div>
          <div dir="ltr">What methodology are you all using to
            periodically purge old reports out of the
            /openils/var/web/reporter folder?
            <div><br>
            </div>
            <div>Thanks</div>
            <div>-Jon</div>
          </div>
        </div>
      </div>
      <br>
      <hr>
      <font size="1" face="Arial" color="Gray"><br>
        Email correspondence to and from this address may be subject to
        the North Carolina Public Records Law and may be disclosed to
        third parties by an authorized state official.<br>
      </font>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Evergreen-general mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Evergreen-general@list.evergreen-ils.org">Evergreen-general@list.evergreen-ils.org</a>
<a class="moz-txt-link-freetext" href="http://list.evergreen-ils.org/cgi-bin/mailman/listinfo/evergreen-general">http://list.evergreen-ils.org/cgi-bin/mailman/listinfo/evergreen-general</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>