Rick: Well, as a first idea, when you run a command via backticks (`), I believe the $? variable gets set with the return value. Most people don't check it..... See perldoc -f system to see how to decode the return value.
Might I suggest a more Perl-centric way of doing this, as well as a few bits that you will find useful in all your scripts.... Yes, "-w" or "use warnings;" and "use strict" can be a pain until you get used to them. Once you're used to them, you begin seeing the things that strict will gripe about while you're writing the code. Anyway, my Perl-centric method: #!/usr/bin/perl -w # # By turning on "-w" and "use strict", the Perl compiler will complain if it # isn't happy about something.... use strict; open (KERNFIFO, "cat /dev/log.fifo |"); while ( <KERNFIFO> ) { if ( /fbd_ioctl/ ){ #print "Skipping line... $_"; } elsif ( /\bslot/ ) { # $cards = $_; # `echo "$cards" >> /var/log/cards/messages`; open(CARDS, ">>/var/log/cards/messages') or die "open /var/log/cards/messages: $!\n"; print CARDS "$_\n"; close(CARDS) or die "close /var/log/cards/messages: $!\n"; } else { # $line = $_; # `echo "$line" >> /var/log/messages`; open(LOG, ">>/var/log/messages') or die "open /var/log/messages: $!\n"; print LOG "$_\n"; close(LOG) or die "close /var/log/messages: $!\n"; } } Hope this helps. Cheers, Dave On Wednesday 02 June 2004 12:25 pm, Parker Richard-A19798 wrote: > I have a program that I wrote which take input from a pipe and then > distributes to certain log files. > > What happens is that for no particular reason that I can find, the program > dies. > > What do I put in to find out what killed it or what it died from? > > #!/usr/bin/perl > > open (KERNFIFO, "cat /dev/log.fifo |"); > > while ( <KERNFIFO> ) { > if ( /fbd_ioctl/ ){ > #print "Skipping line... $_"; > } > elsif ( /\bslot/ ) { > $cards = $_; > `echo "$cards" >> /var/log/cards/messages`; > } > else { > $line = $_; > `echo "$line" >> /var/log/messages`; > } > } > > > > > > Rick Parker > Motorola Inc. / Winphoria Division > 3 Highwood Drive, WEST > Tewksbury, MA 01876 > (978) 805-5686 > [EMAIL PROTECTED] > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.690 / Virus Database: 451 - Release Date: 5/22/2004