Created
August 23, 2012 10:42
-
-
Save anon5r/3435391 to your computer and use it in GitHub Desktop.
Show latest log for nginx (access.log or error.log)
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/sh | |
# | |
# args[1] : hostname | |
# args[2] : access | error | |
# args[3] : date[yyyy/mm] | |
# | |
filehost="*" | |
filetype="access" | |
filedate="current" | |
if [ $# -gt 0 ]; then | |
if [ "$1" != "" ]; then | |
filehost=$1 | |
fi | |
if [ "$2" != "" ]; then | |
filetype=$2 | |
fi | |
if [ "$3" != "" ]; then | |
filedate=$3 | |
fi | |
fi | |
filename="${filehost}-${filetype}.log"; | |
tail -s 0.1 -f /home/logs/nginx/$filedate/$filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment