Saturday, October 11, 2008

timeout

Debian has an interesting command timeout:

timeout 5 tail -f /var/log/messages

If you do not have timeout package installed, perl can be used to perform the same:

perl -e "alarm shift @ARGV; exec @ARGV;" 5 tail -f /var/log/messages

Reference links:
http://michael.thegrebs.com/2008/05/27/most-awesome-command-ever/
http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/

No comments:

Post a Comment