1833870 Members
1689 Online
110063 Solutions
New Discussion

Re: Scripting help....

 
SOLVED
Go to solution
Dwyane Everts_1
Honored Contributor

Scripting help....

All,

I'm trying to write a script, that will monitor the print queue. I need a script that will check the print jobs, and any jobs that have been sitting in queue for longer than 30, the script notify me. The notification part is easy and done....checking the print queue (lpstat -i -o) is easy and done. But how can I compare the print job time to the current system time, and see if it is older than 30 minutes?

Dwyane
4 REPLIES 4
Prashant Zanwar_4
Respected Contributor
Solution

Re: Scripting help....

How about checking /var/spool/lp/request directory for this. you can delete the requests directly here.

I do it like below.


find /var/spool/lp/request ! -name ".*" -type f -mtime +3 -exec rm {} \;

Check for yorself about deleting 30Mins older files.
Hope this helps
Thanks
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Rick Garland
Honored Contributor

Re: Scripting help....

Monitor /var/spool/lp/request directory.

Submitted jobs noted in this dir and have a date/time stamp that you can use for comparison.

The files will be named by the PRTDEV name.

Rick Garland
Honored Contributor

Re: Scripting help....

I had done a perl script for this purpose some time ago - found it.

Attached

Modify as required

Dwyane Everts_1
Honored Contributor

Re: Scripting help....

Thank you much!!!!!

I don't necessarily want to remove thse jobs. This is going to be a way to notify me of printers that probably need some TLCWH (Tender loving care with a hammer!). :)

Actually, we have several serially connected line printers, and Web JetAdmin doesn't have the functionality to monitor them. So, I had to get a little creative. Once I have a functioning script, I will add the opcmsg function of OVOW...

Thanks again!!! Points well deserved!
Dwyane