O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  

Message Manager
Useful status messages from background processes

Contributed by:
Luke Bonanomi
[03/31/03 | Discuss (0) | Link to this hack]

If you run alot of scripts in the background (remotely or on the console), you're likely frustrated by the command line's limited messaging facillities. You could write status messages to syslog via warn, or mail them to yourself, but both options are clumsy.

#! /bin/bash
function read_pipe { 
while cat /home/$USER/pipe; 
do tput cup 100 0; 
OUT=$(cat /home/$USER/pipe); 
printf "$OUT"; done; 
while [[ -p pipe ]]; 
do tput cup 100 0; 

This script will constantly read a named pipe in the user's home directory, and output the contents towards the bottom of the terminal (this will require some adjustment on larger screens).

Example: Track Code Red probes

tail -f ./access_log | awk '/default.ida/ { print $1}' > /home/$USER/pipe

See also: man setterm
man tput

O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.