Skip to content

Instantly share code, notes, and snippets.

@GeoffClements
Last active June 26, 2024 09:08
Show Gist options
  • Save GeoffClements/e334fcde45fd440a576642345b61f13b to your computer and use it in GitHub Desktop.
Save GeoffClements/e334fcde45fd440a576642345b61f13b to your computer and use it in GitHub Desktop.
Monthly cleanup CRON task, place in /etc/cron.monthly
#!/bin/bash
#
# Tidy cron script
#
# This script attempts to tidy up by
# 1. Updating linux-purge and then running it
# 2. Autoremove uninstalled packages
# 3. Clearing out old apt packages
UDLP=/usr/bin/update-linux-purge
LP=/usr/bin/linux-purge
APT=/usr/sbin/apt
test -x ${UDLP} && nice -n 19 ${UDLP} && nice -n 19 ${LP} -k 0 -y
nice -n 19 ${APT} -y autoremove
nice -n 19 ${APT} clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment