Created
March 3, 2017 20:27
-
-
Save grzegorzblaszczyk/6eb9440e0085ac3da056f7d23d730fb0 to your computer and use it in GitHub Desktop.
Freeup log files in workspace
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/bash | |
AWK=`which awk` | |
FIND=`which find` | |
GREP=`which grep` | |
LS=`which ls` | |
echo "Getting the log files..." | |
FILES=`${FIND} . -name "*.log" | ${GREP} "/log/"` | |
echo "Freeing up the disk space..." | |
for file in $FILES; do | |
FILE_SIZE=`${LS} -lh ${file} | ${AWK} '{print $5}' ` | |
echo "Emptying $file file (${FILE_SIZE}) ..." | |
echo -n "" > $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment