LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   run script when a users prints (https://www.linuxquestions.org/questions/linux-desktop-74/run-script-when-a-users-prints-816856/)

Elcrapocrew 06-28-2010 02:59 PM

run script when a users prints
 
How do I write a script (or more correctly, a daemon) that will listen for print jobs and run a script when the user prints?

Basically when the user prints I want to open a browser window that takes them to a portal we have setup to allow them to release the print job, the job will go to the print server immediately, so I don't have to worry about standing in the way of the print job. I just wan to open firefox after the job is submitted to the server.

Any Ideas?

TB0ne 06-28-2010 03:24 PM

Quote:

Originally Posted by Elcrapocrew (Post 4017508)
How do I write a script (or more correctly, a daemon) that will listen for print jobs and run a script when the user prints?

Basically when the user prints I want to open a browser window that takes them to a portal we have setup to allow them to release the print job, the job will go to the print server immediately, so I don't have to worry about standing in the way of the print job. I just wan to open firefox after the job is submitted to the server.

Any Ideas?

Nope, not with details. What are the clients running? How are the printers attached now? How do the users print now??

Best idea I'd have, would be to do away with the portal, web page, clicking, etc., and just go straight through a CUPS server. You'd have a log of who printed what, when, etc., and users wouldn't have to click anything, run any scripts, etc.

Elcrapocrew 06-28-2010 04:45 PM

hahaha, TB0ne you have no idea how badly I would like to do away with that portal page!

Let me give you a bit more info:

I work for a small private college that is thinking about using linux thin clients for our dorm lab computers. We have an existing printing solution that allows our students to print and charges them a set amount depending on the printing in question (color, location, etc.) The print server is Windows Server 2003 and the clients will probably be either Linux Mint or BrowserLinux.

Once the client prints, the printing software on the server catches the job and holds it in a queue, then the student needs to go to a webpage and login with their AD credentials to see the print jobs sent from that computer.

From there the student selects the job they want to print, if the student has enough credit the job prints and the student goes along their merry way.

All of this is set in stone and is non-negotiable.

If the client is windows based, the user will get a popup message after the job is submitted to the print server. This popup is nothing more than an IE window with all the tool bars stripped off. The problem is that the printing solution provider does not have a linux client that does the same thing. The functionality seems pretty basic, when the user prints a job I want to kick off a script that opens firefox and sends them to the portal page that they can release their job from.

I figure I will need to either listen for print events (run a daemon) or hook into cups and have a post print event (kick off a script), either one works for me.

A nasty hackish way could be to watch the syslogs, grepping for print events and firing off the script if it sees one ... but something about that just doesn't sit right with me ... it seems to cobbled together. I am looking for a more elegant solution, elegance = reliability in my experience ... but I guess that largely depends on your idea of elegance ... but I digress : )


All times are GMT -5. The time now is 04:40 PM.