On Wed, Sep 05, 2001 at 03:35:09PM -0700, David Bishop wrote:
> On Wednesday 05 September 2001 01:15 pm, Jens Benecke wrote:
> > On Wed, Sep 05, 2001 at 01:14:56PM -0700, David Bishop wrote:
> > > > Would it be better to change from lpr to lnprg or cups?
> > > Yes :-) Switching to cups is painless, and easy. If this is a home
> > > pc, apt-get install cupsys cupsys-client kups, configure the serv..
> > The coolest thing about CUPS is that once you have _one_ CUPS server ..
> > .. local drivers, no hassle, no installing anything.
> That's why I prefaced with "if this is a home pc". If it's on a coporate
> lan, then I would have walked him through the whole networking thang. :)
> And yes, it's very, very, cool (says someone who spent many frustrating
> hours trying to get remote lpd/r working, grrrr).
Now while we're at it, could you tell me how to integrate custom scripts in
the CUPS system? What I want is this:
- CUPS receives a printing job (always Postscript)
- CUPS counts pages (optional)
- CUPS calls an external script like this
..../accounter.pl $USER $JOBFILE
- IF this script exits with 0, CUPS continues, otherwise the job is
discarded
- IF the print was successful, CUPS calls another script
..../accounter_success.pl $USER $JOBFILE
Alternatively: don't call scripts, but open a TCP connection to a specified
port and 'ask' (via custom commands) a server script for permission to
print. The chat would look like this (this is actually what the perl script
does, which is currently running with lprng):
>>> input
<<< return
Connected to Xxx.xxx.xxx.xx.
Escape character is ^].
>>> auth 3ac141b58e28162dedf29f754045c2cf # or something
<<< auth ok
>>> check $USER $NUMBER # may $USER print $NUMBER pages?
<<< [ok|fail $ERRMSG]
when ok, start the job (optionally keep the connection),
else quit + mail $ERRMSG to $USER ("your quota is empty" etc).
if printing succeeded:
>>> deduct $USER $PAGES
<<< [ok|fail $ERRMSG]
>>> exit
mail $ERRMSG to admin if failed.
--
Jens Benecke ········ http://www.hitchhikers.de/ - Europas Mitfahrzentrale
MSTD, n: MicroSoft Transmitted Disease. Propagates only due to Microsoft's
insistence on distributing [software] that resembles Petri dishes.
See also ILOVEYOU, Melissa, Code Red, Sircam, IIS.
-- http://www.everything2.com/index.pl?node=MSTD
Attachment:
pgpBq2mlKGiR4.pgp
Description: PGP signature