-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete old files from the export app
- Loading branch information
1 parent
34861cd
commit f69b57d
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: batch/v1beta1 | ||
kind: CronJob | ||
metadata: | ||
name: file-cleanup | ||
spec: | ||
schedule: "0 0 * * *" # Run daily at midnight | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: cleanup | ||
image: rnacentral/cleanup:latest | ||
volumeMounts: | ||
- name: export-results | ||
mountPath: /srv/results | ||
volumes: | ||
- name: export-results | ||
persistentVolumeClaim: | ||
claimName: export-results | ||
restartPolicy: OnFailure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#------------------------------------------------------------------------------- | ||
# | ||
# The purpose of this Dockerfile is to delete old files from the export app | ||
# | ||
# Commands use to build and push: | ||
# | ||
# docker buildx create --use | ||
# docker buildx build --platform linux/amd64,linux/arm64 -t rnacentral/cleanup:latest --push . | ||
# | ||
#------------------------------------------------------------------------------- | ||
|
||
FROM alpine:latest | ||
|
||
# install findutils | ||
RUN apk --no-cache add findutils | ||
|
||
# add the cleanup script | ||
COPY cleanup.sh /usr/local/bin/cleanup.sh | ||
|
||
# make the script executable | ||
RUN chmod +x /usr/local/bin/cleanup.sh | ||
|
||
# run the script | ||
CMD ["/usr/local/bin/cleanup.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
# find and delete files older than 7 days | ||
find /srv/results/ -type f -mtime +7 -exec rm -f {} \; |