Month: April 2015

  • Grepping for multiple strings in a file

    We will use egrep which accepts a regular expression to grep for multiple strings.

    tail -f localhost_access_log.txt | egrep "\" 404|\" 500" 
    

    Here our example looks at logs to see if we got 404 or 500 request.

     "GET /favicon.ico HTTP/1.1" 404 973
     "GET /login.html  HTTP/1.1" 500 1230
     "GET /favicon.ico HTTP/1.1" 404 973
    
  • Apache 408 Connection timedout

    nohup tail -f access.log | grep ‘408’ –line-buffered | awk ‘{split($0,a,” “); print a[1]; fflush()}’ | tee -a bad-408.txt

  • Starting jetty via command line an nohup

    Somehow I am getting problems starting Jetty via

    service jetty start
    

    We will be using unix command called nohup
    “Nohup is a unix command, used to start another program, in such a way that it does not terminate when the parent process is terminated.”

    I have opted out for using this

    nohup java -jar start.jar -Djetty.port=8085
    

    while this works it shown an message

    nohup: ignoring input and appending output to `nohup.out'
    

    to fix that up we need to redirect in put and output to /dev/null

     nohup java -jar start.jar -Djetty.port=8085  /dev/null &