Created
September 25, 2015 16:32
-
-
Save rushipkar90/c8e94c478b15c019f25a to your computer and use it in GitHub Desktop.
find150.sh
This file contains hidden or 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/sh | |
# Directory to store log files in | |
DST=/root/logs | |
# Any logs older than this will be deleted first | |
KEEPDAYS=14 | |
# Create DST if it doesn't exist | |
if [ ! -d "$DST" ]; then | |
mkdir $DST | |
fi | |
# Remove logs older than KEEPDAYS in DST | |
find ${DST} -type f -mtime +${KEEPDAYS} -exec rm -f {} \; | |
# Find files over 150MB | |
find /home -type f -size +150000 > ${DST}/files_over150M-`date +%F`.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment