Think In Geek

In geek we trust

Killing all rails logs with one Ctrl+C?

Well, this is my first post after holidays and it won’t be very long.

Imagine you are developing a rails application. Usually you have:

  • a terminal with the server to see what petitions are received.
  • a terminal with a tail of development.log to see what happens with the database.
  • a terminal with a tail of test.log if you are testing something.

This are a lot of windows… And the other day one friends was very happy and after asking for a while I discovered that the reason was the simple line showed above… With only one Ctrl+C you can kill all this processes 🙂

script/server & tail -f log/development.log & tail -f log/test.log & tail -f ; jobs -p | awk '{print "kill -2 " $0}' | sh
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

, , ,

Leave a Reply

Your email address will not be published. Required fields are marked *