Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Created May 14, 2021 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtrouton/5d72da3894577da191059f1393489622 to your computer and use it in GitHub Desktop.
Save rtrouton/5d72da3894577da191059f1393489622 to your computer and use it in GitHub Desktop.
802.remove.autopkg.conductor.logs script, used to remove autopkg-conductor logfiles older than a specified date
#!/bin/bash
# Remove autopkg-conductor logfiles older than a specified number of days
# Add username of the account used to run AutoPkg
autopkg_username="autopkg"
# Age of logfiles to retain. For example, setting the following number
# will delete anything older than 20 days
#
# autopkg_log_age="20"
autopkg_log_age="20"
/usr/bin/find "/Users/$autopkg_username/Library/Logs" -name "autopkg-run-for*" -mindepth 1 -mtime +"$autopkg_log_age" -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment