Monthly cron job to clean up old koji trees for EPEL8/EPEL8-next #10726

Closed
opened 2022-05-28 13:47:35 +00:00 by smooge · 5 comments

Currently every day the rhel8-split.sh and cent8-split.sh creates a new hardlinked tree of files in /mnt/fedora/app/fi-repo/rhel/rhel8/koji/ and /mnt/fedora/app/fi-repo/centos/stream8-kojitarget. This adds up over time in hardlink counts on various files and makes looking at those directories ugly.

What is needed is a once a month cron job that removes all the directories from the month before. This will allow a smaller directory listing and also faster ls/find on certain trees. This cron job would be in ansible tree roles/grobisplitter/files and would be run on batcave01.

Currently every day the rhel8-split.sh and cent8-split.sh creates a new hardlinked tree of files in `/mnt/fedora/app/fi-repo/rhel/rhel8/koji/` and `/mnt/fedora/app/fi-repo/centos/stream8-kojitarget`. This adds up over time in hardlink counts on various files and makes looking at those directories ugly. What is needed is a once a month cron job that removes all the directories from the month before. This will allow a smaller directory listing and also faster ls/find on certain trees. This cron job would be in ansible tree `roles/grobisplitter/files` and would be run on batcave01.
Contributor

Metadata Update from @zlopez:

  • Issue priority set to: Waiting on Assignee (was: Needs Review)
  • Issue tagged with: low-gain, low-trouble, ops
**Metadata Update from @zlopez**: - Issue priority set to: Waiting on Assignee (was: Needs Review) - Issue tagged with: low-gain, low-trouble, ops

Something like find /mnt/fedora/app/fi-repo/rhel/rhel8/koji/ /mnt/fedora/app/fi-repo/centos/stream8-kojitarget -mindepth 1 -maxdepth 1 -type d -mtime +30 -print -exec rm -rf '{}' \; should work. It will find all the daily subdirectories that are 31 days or older and delete them. It can be run on a monthly cron job or even at the end of the *-split.sh scripts each day. I suppose I could submit a PR, but it would be nice if someone with actual access could make sure it works as expected.

Something like `find /mnt/fedora/app/fi-repo/rhel/rhel8/koji/ /mnt/fedora/app/fi-repo/centos/stream8-kojitarget -mindepth 1 -maxdepth 1 -type d -mtime +30 -print -exec rm -rf '{}' \;` should work. It will find all the daily subdirectories that are 31 days or older and delete them. It can be run on a monthly cron job or even at the end of the `*-split.sh` scripts each day. I suppose I could submit a PR, but it would be nice if someone with actual access could make sure it works as expected.

Thanks for the tip @gotmax23 , tried your suggestion and it seems to work just fine.
I added a line in both cron files executing the command.
Here is the PR: https://pagure.io/fedora-infra/ansible/pull-request/1109

Thanks for the tip @gotmax23 , tried your suggestion and it seems to work just fine. I added a line in both cron files executing the command. Here is the PR: https://pagure.io/fedora-infra/ansible/pull-request/1109

I merged the pr and pushed it out. Thanks everyone!

I merged the pr and pushed it out. Thanks everyone!

Metadata Update from @kevin:

  • Issue close_status updated to: Fixed with Explanation
  • Issue status updated to: Closed (was: Open)
**Metadata Update from @kevin**: - Issue close_status updated to: Fixed with Explanation - Issue status updated to: Closed (was: Open)
Sign in to join this conversation.
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Infrastructure/fedora-infrastructure#10726
No description provided.