Skip to content

Instantly share code, notes, and snippets.

@dubcl
Created May 19, 2017 19:05
Show Gist options
  • Save dubcl/b95acb0b280bf4c7e1548077738368bc to your computer and use it in GitHub Desktop.
Save dubcl/b95acb0b280bf4c7e1548077738368bc to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Compress bak files from qbiz server
# and delete files older than 30 days
#
# Carlos Albornoz <caralbornozc@gmail.com>
DIR=/opt/backup
cd $DIR
for FILE in $(ls *.bak);
do
gzip $FILE;
done
find . -mtime +20 -type f -name "*.bak.gz" -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment