How to run script before (and after) printing?

Thomas Ricatte elenaher at via.ecp.fr
Tue Sep 2 01:20:47 PDT 2008


> On Fri, Aug 29, 2008 at 01:03:47AM -0700, Tijmen Stam wrote:
> > Hello,
> >
> > I have just installed a new printer using CUPS and it works perfectly. However, I print very rarely - maybe once a month or so - and it's a waste to have the printer on wasting power all the time. Therefore, I have bought a Gembird SIS-PMS power block, which can switch off and on power outlets via USB. Also works perfectly.
> >
> > What I'd like to do is that before CUPS start printing, the printer is switched on, and afterwards a timer is set to switch it off in 15 minutes (printing again cancels that timer - I still have to work out the details). The start command can be as simple as "sispmctl -o 1" - but later on will have to be some kind of shell script that also cancels the timer.
> >
> > Question: I can't find anywhere to issue pre-printing commands. However I can't believe such a thing doesn't exist. Where can I find this?
>
> <shameless plug="ON">
>   http://www.pykota.com/software/tea4cups/
> </shameless>
>
> hth
>
> Jerome Alet
>

An other solution is to create your own backend (it's quite easy) and to modify the URI of your device. Your backend will call your script and then launch the job using the original backend that you are currently using.
(Just put an executable file in /usr/lib/cups/backend to define a new backend. This file can be a simple .sh script for example)




More information about the cups mailing list