<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic A script to check the print queues? in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/a-script-to-check-the-print-queues/m-p/3621634#M104705</link>
    <description>I like to create a script to check all the print queues?  If print jobs are stuck in the queue for more than 10 minutes, it should send an email alert to the administrator.&lt;BR /&gt;&lt;BR /&gt;Any suggestions? &lt;BR /&gt;&lt;BR /&gt;Thank you in advanced for answers.</description>
    <pubDate>Thu, 08 Sep 2005 08:11:17 GMT</pubDate>
    <dc:creator>B. Jen</dc:creator>
    <dc:date>2005-09-08T08:11:17Z</dc:date>
    <item>
      <title>A script to check the print queues?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/a-script-to-check-the-print-queues/m-p/3621634#M104705</link>
      <description>I like to create a script to check all the print queues?  If print jobs are stuck in the queue for more than 10 minutes, it should send an email alert to the administrator.&lt;BR /&gt;&lt;BR /&gt;Any suggestions? &lt;BR /&gt;&lt;BR /&gt;Thank you in advanced for answers.</description>
      <pubDate>Thu, 08 Sep 2005 08:11:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/a-script-to-check-the-print-queues/m-p/3621634#M104705</guid>
      <dc:creator>B. Jen</dc:creator>
      <dc:date>2005-09-08T08:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: A script to check the print queues?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/a-script-to-check-the-print-queues/m-p/3621635#M104706</link>
      <description>Here's the correct script - just update YOU\@YOURDOMAIN.COM with your email address:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl -w&lt;BR /&gt;# script to email print jobs older then 3 hours&lt;BR /&gt;# can be modified for different time&lt;BR /&gt;# just update variables: STALE_TIME, $subject and $mailID&lt;BR /&gt;# gwild&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use constant VARLPDIR =&amp;gt; "/var/spool/lp/request";&lt;BR /&gt;use constant STALE_TIME =&amp;gt; (3 * 3600);&lt;BR /&gt;&lt;BR /&gt;## define the variables for use&lt;BR /&gt;my $dirname = VARLPDIR;&lt;BR /&gt;my $stale = STALE_TIME;&lt;BR /&gt;my $now = time();&lt;BR /&gt;my $file;&lt;BR /&gt;my $prt;&lt;BR /&gt;my $prtjob;&lt;BR /&gt;my $line;&lt;BR /&gt;my $count;&lt;BR /&gt;my $HOST = "`hostname`";&lt;BR /&gt;my $subject = "print jobs over 3 hrs old - $HOST";&lt;BR /&gt;my $mailID = "YOU\@YOURDOMAIN.COM";&lt;BR /&gt;my $amtime = "strftime('%m-%d-%Y')";&lt;BR /&gt;&lt;BR /&gt;  open(MAIL, "|/usr/bin/mailx -s \"$subject\" $mailID");&lt;BR /&gt;  opendir(VARLP, "/var/spool/lp/request") || die "Can't open the directory\n";&lt;BR /&gt;  my @filelist = grep (!/^\./, grep (!/^PDR/, grep (!/\./, readdir(VARLP))));&lt;BR /&gt;  closedir(VARLP);&lt;BR /&gt;  foreach $file (@filelist) {&lt;BR /&gt;    my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime) = stat("$dirname/$file");&lt;BR /&gt;    opendir(PRTLST, "$dirname/$file") || die "Can't open\n";&lt;BR /&gt;    my @prts = grep (!/^\./, grep (!/^d/, grep (!/^t/, readdir(PRTLST))));&lt;BR /&gt;    closedir(PRTLST);&lt;BR /&gt;    foreach $prt (@prts) {&lt;BR /&gt;      my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime) = stat("$dirname/$file/$prt");&lt;BR /&gt;      if ($now &amp;gt; ($mtime + $stale)) {&lt;BR /&gt;        open(PRTFILE,"$dirname/$file/$prt");&lt;BR /&gt;        my $count = 0;&lt;BR /&gt;        while (&lt;PRTFILE&gt;) {&lt;BR /&gt;          $count++ ;&lt;BR /&gt;          last if ($count == 3);&lt;BR /&gt;        }&lt;BR /&gt;        select(MAIL);&lt;BR /&gt;        $| = 1;&lt;BR /&gt;        print MAIL substr($_,1) unless /^$/;&lt;BR /&gt;      }&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;close(MAIL);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;/PRTFILE&gt;</description>
      <pubDate>Thu, 08 Sep 2005 08:30:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/a-script-to-check-the-print-queues/m-p/3621635#M104706</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2005-09-08T08:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: A script to check the print queues?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/a-script-to-check-the-print-queues/m-p/3621636#M104707</link>
      <description>The basics is that you are checking the date/time stamp of the files in the /var/spool/lp/request directory.&lt;BR /&gt;&lt;BR /&gt;This is where print jobs are spooled off to before they are sent to the printer.&lt;BR /&gt;&lt;BR /&gt;The perl script posted by Geoff can be set in cron to check the print queue as ofter as you like&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Sep 2005 08:42:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/a-script-to-check-the-print-queues/m-p/3621636#M104707</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2005-09-08T08:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: A script to check the print queues?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/a-script-to-check-the-print-queues/m-p/3621637#M104708</link>
      <description>Bernard,&lt;BR /&gt;&lt;BR /&gt;I also noticed that you havn't assigned points to any of your questions...&lt;BR /&gt;&lt;BR /&gt;Please read:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/helptips.do?#28" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/helptips.do?#28&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Points help others who search determine which is the best answer to a question...&lt;BR /&gt;&lt;BR /&gt;How many points should I assign to replies? &lt;BR /&gt;Every response to your question is eligible to earn between 1-10 points. No need to worry about running out of points - when a truly awesome reply rolls in that deserves a 10, you will be able to assign it a 10! However, be careful to assign points based on the value that a reply truly provides. Use the following scale as a guideline:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;o N/A: The answer was simply a point of clarification to my original question &lt;BR /&gt;&lt;BR /&gt;o 1-3: The answer didn't really help answer my question, but thanks for your assistance! &lt;BR /&gt;&lt;BR /&gt;o 4- 7: The answer helped with a portion of my question, but I still need some additional help! &lt;BR /&gt;&lt;BR /&gt;o 8-10: The answer has solved my problem completely! Now I'm a happy camper! &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Although assigning points is not mandatory, it is a key component of a strong, interactive community, and it is STRONGLY ENCOURAGED. Others have taken time to help you, so please take a moment to give them credit for their assistance! &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks...Geoff</description>
      <pubDate>Thu, 08 Sep 2005 09:01:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/a-script-to-check-the-print-queues/m-p/3621637#M104708</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2005-09-08T09:01:31Z</dc:date>
    </item>
  </channel>
</rss>

