Skip to content

Instantly share code, notes, and snippets.

@krzysbaranski
Created November 8, 2019 17:03
Show Gist options
  • Save krzysbaranski/4f97b61d4902382e164bcb17153b8403 to your computer and use it in GitHub Desktop.
Save krzysbaranski/4f97b61d4902382e164bcb17153b8403 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "rundeck logs compression and cleanup..."
set -exp
find /var/log/rundeck -name "rundeck.*.log.$(date -u +%Y-%m)-??" -exec xz -v {} \;
find /var/log/rundeck -name "rundeck.*.log.$(date -u -d "-1 month" +%Y-%m)-??" -exec xz -v {} \;
find /var/log/rundeck -name "rundeck.*.log.$(date -u -d "-2 month" +%Y-%m)-*" -exec rm -v {} \;
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment