forked from davidsbond/homelab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrontab
19 lines (14 loc) · 803 Bytes
/
crontab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# This file contains all my custom cron jobs to run on each k3s node host, each job is a general
# maintenance thing, either to keep things up-to-date or to reduce resource usage. This is managed
# from the central homelab repository and shouldn't be modified directly on the host.
# Delete unused container images
@daily sudo k3s crictl rmi --prune
# Clear logs older than 1 day
@daily sudo journalctl --vacuum-time=1d
# Clear rotated and compressed logs
@daily sudo find /var/log -type f -regex ".*\.gz$" -delete
@daily sudo find /var/log -type f -regex ".*\.[0-9]$" -delete
# Clear temporary files that have not been accessed in 7 days
@daily sudo find /tmp -type f -atime +7 -delete
# Upgrade packages weekly
@weekly sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove -y