[Evergreen-general] [External] Reporter folder cleanup question

Jason Stephenson jason at sigio.com
Tue May 28 15:48:38 EDT 2024


I hit reply too soon!

We also run this a few minutes later to remove empty directories:

find /openils/var/data/reports/ -empty -type d -delete

You could bundle them up into a single script. I recommend running the 
above find command after the one in the previous email.

On 5/28/24 15:46, Jason Stephenson wrote:
> Jon,
> 
> We run something similar to what Blake shared below.
> 
> We also run this daily via crontab to remove the files after 90 days:
> 
> find /openils/var/data/reports/ -type f -mtime +90 -delete
> 
> You'll need to adjust "/openils/var/data" for wherever your reports are 
> stored.
> 
> HtH,
> Jason Stephenson
> 
> On 5/28/24 15:29, Blake Graham-Henderson via Evergreen-general wrote:
>> Jon,
>>
>> Here's the cron line:
>>
>>
>> # purge 90 day old reports
>> 0 01 * * * psql  < purge_reports.sql >/dev/null 2>&1
>>
>> And the contents of purge_reports.sql:
>>
>> BEGIN;
>>
>> DELETE FROM reporter.schedule WHERE run_time<NOW()-INTERVAL '90 days';
>> DELETE  FROM reporter.report WHERE create_time<NOW()-INTERVAL '90 
>> days' AND recur=FALSE AND id NOT IN
>> (SELECT r.id FROM reporter.report r INNER JOIN reporter.schedule s ON 
>> r.id=s.report);
>>
>> COMMIT;
>>
>>
>> -Blake-
>> Conducting Magic
>> Will consume any data format
>> MOBIUS
>>
>> On 5/28/2024 1:45 PM, Murphy, Benjamin via Evergreen-general wrote:
>>> 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.)
>>>
>>> *Benjamin Murphy*
>>>
>>> NC Cardinal Program Manager
>>>
>>> State Library of North Carolina
>>>
>>> _benjamin.murphy at dncr.nc.gov _ | 
>>> https://statelibrary.ncdcr.gov/services-libraries/nc-cardinal
>>>
>>> 109 East Jones Street  | 4640 Mail Service Center
>>>
>>> Raleigh, North Carolina 27699-4600
>>>
>>> The State Library is part of the NC Department of Natural & Cultural 
>>> Resources.
>>>
>>> /Email correspondence to and from this address is subject to the 
>>> North Carolina Public Records Law and may be disclosed to third 
>>> parties./
>>>
>>> Please note new email address
>>>
>>> ------------------------------------------------------------------------
>>> *From:* Evergreen-general 
>>> <evergreen-general-bounces at list.evergreen-ils.org> on behalf of 
>>> JonGeorg SageLibrary via Evergreen-general 
>>> <evergreen-general at list.evergreen-ils.org>
>>> *Sent:* Tuesday, May 28, 2024 2:35 PM
>>> *To:* Evergreen Discussion Group 
>>> <evergreen-general at list.evergreen-ils.org>
>>> *Cc:* JonGeorg SageLibrary <jongeorg.sagelibrary at gmail.com>
>>> *Subject:* [External] [Evergreen-general] Reporter folder cleanup 
>>> question
>>> CAUTION: 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.
>>>
>>> What methodology are you all using to periodically purge old reports 
>>> out of the /openils/var/web/reporter folder?
>>>
>>> Thanks
>>> -Jon
>>>
>>> ------------------------------------------------------------------------
>>>
>>> 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.
>>>
>>> _______________________________________________
>>> Evergreen-general mailing list
>>> Evergreen-general at list.evergreen-ils.org
>>> http://list.evergreen-ils.org/cgi-bin/mailman/listinfo/evergreen-general
>>
>>
>> _______________________________________________
>> Evergreen-general mailing list
>> Evergreen-general at list.evergreen-ils.org
>> http://list.evergreen-ils.org/cgi-bin/mailman/listinfo/evergreen-general


More information about the Evergreen-general mailing list