How to run a script when ever I send a print job to a specific print queue?












0















I am running Arch-linux and Openbox. Arch-linux has been fully updated today.



I can power on and off my printer, a HP LaserJet 2200, using a shell script & keyboard shortcuts associated with the script.



I need to intercept any system command to print to this print queue and use it to trigger the shell script to turn the printer on, automatically.



How can I detect any print job sent to a specific print queue and then run the shell script at this time?
(I have 2 or three printers so it has to be able to detect the specific print queue to turn on the right printer)










share|improve this question

























  • I suppose I could run a cron job to look at the print queue every 30 secs or so but that seems inelegant.

    – Kes
    Feb 20 at 12:16











  • or I could recompile one of the core print packages to also run my script but I don't know which one, or much about C which it may well be written in

    – Kes
    Feb 21 at 12:16













  • I can now also get the printer status off the HP LaserJet printer JetDirect network card using SNMP v2 and the snmpwalk command. When I'm able to trigger a script when something arrives in the print queue I'm going to be able to turn the printer on automatically and then query the printer until it is idle to turn the printer off once the job is complete. Still can't figure out how to trigger the script though

    – Kes
    Feb 22 at 16:33


















0















I am running Arch-linux and Openbox. Arch-linux has been fully updated today.



I can power on and off my printer, a HP LaserJet 2200, using a shell script & keyboard shortcuts associated with the script.



I need to intercept any system command to print to this print queue and use it to trigger the shell script to turn the printer on, automatically.



How can I detect any print job sent to a specific print queue and then run the shell script at this time?
(I have 2 or three printers so it has to be able to detect the specific print queue to turn on the right printer)










share|improve this question

























  • I suppose I could run a cron job to look at the print queue every 30 secs or so but that seems inelegant.

    – Kes
    Feb 20 at 12:16











  • or I could recompile one of the core print packages to also run my script but I don't know which one, or much about C which it may well be written in

    – Kes
    Feb 21 at 12:16













  • I can now also get the printer status off the HP LaserJet printer JetDirect network card using SNMP v2 and the snmpwalk command. When I'm able to trigger a script when something arrives in the print queue I'm going to be able to turn the printer on automatically and then query the printer until it is idle to turn the printer off once the job is complete. Still can't figure out how to trigger the script though

    – Kes
    Feb 22 at 16:33
















0












0








0








I am running Arch-linux and Openbox. Arch-linux has been fully updated today.



I can power on and off my printer, a HP LaserJet 2200, using a shell script & keyboard shortcuts associated with the script.



I need to intercept any system command to print to this print queue and use it to trigger the shell script to turn the printer on, automatically.



How can I detect any print job sent to a specific print queue and then run the shell script at this time?
(I have 2 or three printers so it has to be able to detect the specific print queue to turn on the right printer)










share|improve this question
















I am running Arch-linux and Openbox. Arch-linux has been fully updated today.



I can power on and off my printer, a HP LaserJet 2200, using a shell script & keyboard shortcuts associated with the script.



I need to intercept any system command to print to this print queue and use it to trigger the shell script to turn the printer on, automatically.



How can I detect any print job sent to a specific print queue and then run the shell script at this time?
(I have 2 or three printers so it has to be able to detect the specific print queue to turn on the right printer)







shell-script arch-linux printing printer






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 19 at 8:23







Kes

















asked Feb 17 at 15:59









KesKes

966




966













  • I suppose I could run a cron job to look at the print queue every 30 secs or so but that seems inelegant.

    – Kes
    Feb 20 at 12:16











  • or I could recompile one of the core print packages to also run my script but I don't know which one, or much about C which it may well be written in

    – Kes
    Feb 21 at 12:16













  • I can now also get the printer status off the HP LaserJet printer JetDirect network card using SNMP v2 and the snmpwalk command. When I'm able to trigger a script when something arrives in the print queue I'm going to be able to turn the printer on automatically and then query the printer until it is idle to turn the printer off once the job is complete. Still can't figure out how to trigger the script though

    – Kes
    Feb 22 at 16:33





















  • I suppose I could run a cron job to look at the print queue every 30 secs or so but that seems inelegant.

    – Kes
    Feb 20 at 12:16











  • or I could recompile one of the core print packages to also run my script but I don't know which one, or much about C which it may well be written in

    – Kes
    Feb 21 at 12:16













  • I can now also get the printer status off the HP LaserJet printer JetDirect network card using SNMP v2 and the snmpwalk command. When I'm able to trigger a script when something arrives in the print queue I'm going to be able to turn the printer on automatically and then query the printer until it is idle to turn the printer off once the job is complete. Still can't figure out how to trigger the script though

    – Kes
    Feb 22 at 16:33



















I suppose I could run a cron job to look at the print queue every 30 secs or so but that seems inelegant.

– Kes
Feb 20 at 12:16





I suppose I could run a cron job to look at the print queue every 30 secs or so but that seems inelegant.

– Kes
Feb 20 at 12:16













or I could recompile one of the core print packages to also run my script but I don't know which one, or much about C which it may well be written in

– Kes
Feb 21 at 12:16







or I could recompile one of the core print packages to also run my script but I don't know which one, or much about C which it may well be written in

– Kes
Feb 21 at 12:16















I can now also get the printer status off the HP LaserJet printer JetDirect network card using SNMP v2 and the snmpwalk command. When I'm able to trigger a script when something arrives in the print queue I'm going to be able to turn the printer on automatically and then query the printer until it is idle to turn the printer off once the job is complete. Still can't figure out how to trigger the script though

– Kes
Feb 22 at 16:33







I can now also get the printer status off the HP LaserJet printer JetDirect network card using SNMP v2 and the snmpwalk command. When I'm able to trigger a script when something arrives in the print queue I'm going to be able to turn the printer on automatically and then query the printer until it is idle to turn the printer off once the job is complete. Still can't figure out how to trigger the script though

– Kes
Feb 22 at 16:33












0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f501185%2fhow-to-run-a-script-when-ever-i-send-a-print-job-to-a-specific-print-queue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f501185%2fhow-to-run-a-script-when-ever-i-send-a-print-job-to-a-specific-print-queue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to make a Squid Proxy server?

Is this a new Fibonacci Identity?

19世紀