Created
March 23, 2015 08:39
-
-
Save countless-integers/156d8ed9437b5718d5bf to your computer and use it in GitHub Desktop.
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 | |
usage() | |
{ | |
cat << EOF | |
usage: $0 options | |
Tail project log | |
OPTIONS: | |
-e Error log (default) | |
-a Access log | |
-c CLI | |
-d date %Y%m%d (default: today) | |
EOF | |
} | |
LOG_PATH="/logs" | |
ERROR=1 | |
TYPE="php" | |
SOURCE="apache" | |
DATE=$(date +%Y%m%d) | |
while getopts “eacd:” OPTION | |
do | |
case $OPTION in | |
e) | |
ERROR=1 | |
;; | |
a) | |
TYPE="apache" | |
;; | |
c) | |
SOURCE="cli" | |
;; | |
d) | |
DATE=$OPTION | |
;; | |
?) | |
usage | |
exit | |
;; | |
esac | |
done | |
shift $((OPTIND-1)) | |
PROJECT_NAME="$1" | |
echo Displaying logs for ${PROJECT_NAME} for ${DATE} | |
sleep 2 | |
tail -f -n 100 /${LOG_PATH}/${TYPE}/*/${DATE}/${PROJECT_NAME}-*-${SOURCE}.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment