[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Printcap doesn't run filter script



I've got an /etc/printcap (permissions = -rw-r--r--  root root) that looks
like:

 beeper:\
        :if=/home/westk/beeper-filter:\
 	:lp=/dev/null:\
 	:sd=/var/spool/lpd/beeper:

(permissions on /var/spool/lpd/beeper = -drwxrwxr-x  lp lp)

and a /home/westk/beeper-filter (permissions = -rwxr-xr-x  root root) that
looks like:

 #!/usr/bin/perl
 $recipient = "westk\@home";
 $subject = "Beeper Message";
 $mailprog = "mail";

 open (MAIL, "|$mailprog -s \'$subject\' $recipient");
 
 print MAIL "------------ Header Line\n\n";
 
 while (<STDIN>) {
     print MAIL $_;
 }
 
 print MAIL "\n------------ Footer Line\n";
 close MAIL;
 
 

As root in any non-empty directory (such as /etc), I'm typing
	ls -l|lpr -Pbeeper
Then four files appear in the spool directory and stay until I rm them, 
and the mail message is apparently never generated (at least it never 
shows up in my mailbox).

I've also tried putting a
	print "Text";
just after the 
	#!/usr/bin/perl
line, but I never see the test message printed. However, I just realized,
could the test message be printing to /dev/null? If so, how do I redirect 
the test message to my screen so that I can verify that the beeper-filter 
is being run when I print something?

(Thanks to Jim Foltz for getting me this far, esp the basic script.)


Reply to: