Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

this is a home setup. A central printer server (Linux) manages the queue, a HP 2430DTN is attached to it via 100Mbit/sec Ethernet. The printer is hooked up to a managable power source. A shell script watches the queue on the server (lpstat -o) and turn on the printer when there is a job. If the queue is empty for 10 minutes it turns the printer off.

Now this setup messes up, stops the printer etc. after a couple of weeks and is in general "not so reliable". I now know how to change the stop-printer thing, but:

Is there a way to run my turn printer on script and turn printer off script directly from cups without watching the queue? That would be so cool!

share|improve this question
add comment

2 Answers

My suggestion is to use tea4cups.

tea4cups serves as a generic wrapper around any standard CUPS backend. It allows you to configure any command to run before and after sending the job off via the real backend.

tea4cups specifically allows (any number of) commands to be run before the job is sent off: prehooks. A prehook command which exits -1 can cancel the job.

tea4cups also allows (any number of) commands to be run after the job is sent off: posthooks (unless a prehook with exit -1 cancelled the job).

Prehooks can send data to the posthooks through pipes.

tea4cups can also run filters (which may modify the print data before sending them off to the real printer through the real backend).

From now on, only your own creativity is a limit to what you can do with this framework.

share|improve this answer
add comment

You could look into doing it through a CUPS backend script. Here's how someone did it using an X10 module.

share|improve this answer
    
Links dead. Not sure what it was pointing to. –  slm Jun 14 at 11:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.