Created
October 8, 2015 07:50
-
-
Save linusfoldemo/ba9cde7bb96769fe11b6 to your computer and use it in GitHub Desktop.
Simple script to locate logs in a directory structure
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 | |
die() { | |
echo $1 | |
echo "Usage: $0 application environment date" | |
echo "environment is TEST/BETA/DEMO/PROD" | |
echo "date pattern is yyyy-MM-dd" | |
exit 1 | |
} | |
[ $# -ge 2 ] || die "Too few arguments." | |
APPLICATION=$1 | |
ENVIRONMENT=$2 | |
DATE=$3 | |
if [ $DATE ]; then | |
find ~/logger/ -iname \*$APPLICATION\*-$ENVIRONMENT\*-$DATE\.log\* | sort | |
else | |
find ~/logger/ -iname \*$APPLICATION\*-$ENVIRONMENT\*\.log\* | sort | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment