Last active
January 18, 2018 15:44
-
-
Save michabbb/72a0daf169e2047eccc4dc899c6e0621 to your computer and use it in GitHub Desktop.
Compress Files from Last Day and Remove after Compression (file format like YYYYMMDD....)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE=`date +%Y%m%d -d "1 day ago"` | |
echo $DATE | |
cd /var/log/xxxxx | |
find . -maxdepth 1 -name "$DATE*.bz2" -type f -print0| tar cjfv /var/log/xxxxx/byday/xxx.$DATE.tar.bz2 --remove-files --null -T - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment