Skip to content

Commit caccac3

Browse files
committed
Create cronjob to clean up disk space periodically
A new cronjob has been created that looks for unused build artifacts and deletes them. The job runs every day at midnight.
1 parent 697c3c9 commit caccac3

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
- name: Copy cleanup script
3+
template:
4+
src: clean-unused-checkouts.sh
5+
dest: /etc/cron.cleanup_disk_space
6+
owner: root
7+
group: root
8+
mode: 0744
9+
10+
- name: Set up the cleanup cron job
11+
template:
12+
src: cron_cleanup_disk_space.j2
13+
dest: /etc/cron.d/cleanup_disk_space
14+
# if the cron job is running right now, keep retrying until it finishes
15+
register: cleanup_cron_result
16+
until: cleanup_cron_result is not failed
17+
retries: 10
18+
delay: 5

ansible/roles/dev-desktop/tasks/team_login.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
- name: Set up the team login cron job
1515
template:
16-
src: crontab_append
16+
src: cron_team_login.j2
1717
dest: /etc/cron.d/team_login
1818
# if the cron job is running right now, keep retrying until it finishes
1919
register: task_result

ansible/roles/dev-desktop/files/clean-unused-checkouts.sh renamed to ansible/roles/dev-desktop/templates/clean-unused-checkouts.sh

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/bin/env bash
22

3+
#
4+
# {{ ansible_managed }}
5+
#
6+
37
# Clean up unused checkouts
48
#
59
# This script is used to find old checkouts that are no longer in use. Given the
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
2+
0 0 * * * root /etc/cron.cleanup_disk_space

0 commit comments

Comments
 (0)