Skip to content

Commit

Permalink
Create cronjob to clean up disk space periodically
Browse files Browse the repository at this point in the history
A new cronjob has been created that looks for unused build artifacts and
deletes them. The job runs every day at midnight.
  • Loading branch information
jdno committed Feb 16, 2024
1 parent 697c3c9 commit caccac3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
18 changes: 18 additions & 0 deletions ansible/roles/dev-desktop/tasks/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Copy cleanup script
template:
src: clean-unused-checkouts.sh
dest: /etc/cron.cleanup_disk_space
owner: root
group: root
mode: 0744

- name: Set up the cleanup cron job
template:
src: cron_cleanup_disk_space.j2
dest: /etc/cron.d/cleanup_disk_space
# if the cron job is running right now, keep retrying until it finishes
register: cleanup_cron_result
until: cleanup_cron_result is not failed
retries: 10
delay: 5
2 changes: 1 addition & 1 deletion ansible/roles/dev-desktop/tasks/team_login.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

- name: Set up the team login cron job
template:
src: crontab_append
src: cron_team_login.j2
dest: /etc/cron.d/team_login
# if the cron job is running right now, keep retrying until it finishes
register: task_result
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env bash

#
# {{ ansible_managed }}
#

# Clean up unused checkouts
#
# This script is used to find old checkouts that are no longer in use. Given the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 0 * * * root /etc/cron.cleanup_disk_space

0 comments on commit caccac3

Please sign in to comment.