View Single Post
  #1   (View Single Post)  
Old 24th May 2013
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default Automatic dual xterm setup for log file monitoring

While testing a Apache webserver configuration, I became tired of setting up two xterms for monitoring both the /var/log/httpd-access and /var/log/httpd-error.log files.

The following simple script does this now for me:

Code:
#!/bin/sh

# Set up two xterms
#   1) tail -f /var/log/httpd-access.log
#   2) tail -f /var/log/http-error.log

ACCESS='ssh j65nko.org "tail -f /var/log/httpd-access.log"'
ERROR='ssh j65nko.org "tail -f /var/log/httpd-error.log"'

# geometry (See X(7)  'GEOMETRY SPECIFICATIONS')
# WidthxHeight+X_offset+Y_offset
# Width and Height either in pixels or characters
# X_offset and Y_offset in pixels

# See xterm(1) for the other options

xterm -geometry 200x30+0+0   -bg black -fg green -e "${ACCESS}" &
xterm -geometry 200x30+0+500 -bg black -fg red   -e "${ERROR}" &
Please note that according to the xterm manual page. the -e option for specifiying the command needs to be the last one.

This script has been tested and is being used in Debian as you can see in the trimmed screenshot.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 24th May 2013 at 01:02 AM.
Reply With Quote