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

Re: Printing with KDE 2.2

Well, after searching around, I can't find anything regarding running 
external scripts with cups.  The only *workaround* I can find would be to 
somehow make a "filter" that every job passes though, which runs your script. 
I would be willing to bet that it's just an oversight on my part, and a quick 
post to the cups newsgroups 
(http://www.cups.org/newsgroups.php?Gcups.general+H+VR) would get you an 
answer.  However, I also found built-in job accounting (job-billing, 
according to ipp), that would probably fit the bill, if you invested a bit of 
time rewritting your scripts.  If you combine job-billing with user 
authentication (both native in cups 1.1), you should be set.



> 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.

Reply to: