<?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 scripting help for LP command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848175#M770893</link>
    <description>UNIX newbie needs scripting help for boring manual process. Each day I do the following:&lt;BR /&gt;lpstat -o&lt;BR /&gt;cancel AcctHold_1-#### (where #### is the print job having the largest kb size)&lt;BR /&gt;enable AcctHold_1 (and wait 30sec)&lt;BR /&gt;disable AcctHold_1&lt;BR /&gt;&lt;BR /&gt;This lpstat usually has only 2 print jobs, a small and super-huge one. Is there a way to make a script do the same steps above, but have it (script) automatically figure out which print job is the largest and kill that one? The two print jobs differ greatly in size. Any help/suggestions would be -- awesome. Thanks -- UX Newbie</description>
    <pubDate>Mon, 21 Apr 2003 18:52:46 GMT</pubDate>
    <dc:creator>Peter A. Berger Jr.</dc:creator>
    <dc:date>2003-04-21T18:52:46Z</dc:date>
    <item>
      <title>scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848175#M770893</link>
      <description>UNIX newbie needs scripting help for boring manual process. Each day I do the following:&lt;BR /&gt;lpstat -o&lt;BR /&gt;cancel AcctHold_1-#### (where #### is the print job having the largest kb size)&lt;BR /&gt;enable AcctHold_1 (and wait 30sec)&lt;BR /&gt;disable AcctHold_1&lt;BR /&gt;&lt;BR /&gt;This lpstat usually has only 2 print jobs, a small and super-huge one. Is there a way to make a script do the same steps above, but have it (script) automatically figure out which print job is the largest and kill that one? The two print jobs differ greatly in size. Any help/suggestions would be -- awesome. Thanks -- UX Newbie</description>
      <pubDate>Mon, 21 Apr 2003 18:52:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848175#M770893</guid>
      <dc:creator>Peter A. Berger Jr.</dc:creator>
      <dc:date>2003-04-21T18:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848176#M770894</link>
      <description>hi Thomas,&lt;BR /&gt;&lt;BR /&gt;Would be helpful if you could throw the output of the lpstat -o command.&lt;BR /&gt;&lt;BR /&gt;- ramd.</description>
      <pubDate>Mon, 21 Apr 2003 18:56:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848176#M770894</guid>
      <dc:creator>Ramkumar Devanathan</dc:creator>
      <dc:date>2003-04-21T18:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848177#M770895</link>
      <description>First, if it is always on printer AcctHold_1, then just do a :&lt;BR /&gt;&lt;BR /&gt;lpstat AcctHold_1&lt;BR /&gt;&lt;BR /&gt;Next, is the the name of the large file being printed always the same?&lt;BR /&gt;Is the size of the large file always the same?&lt;BR /&gt;Does the large file always get submitted at the same time?&lt;BR /&gt;&lt;BR /&gt;That would make it easier - else you'll have to do some comparing with AWK....&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Apr 2003 19:40:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848177#M770895</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2003-04-21T19:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848178#M770896</link>
      <description>If you use perl, you can scan the "request" folder for the printer for print jobs.&lt;BR /&gt;&lt;BR /&gt;$prt="AcctHold_1";&lt;BR /&gt;chdir("/var/spool/lp/request/$prt");&lt;BR /&gt;open(INP,"/usr/bin/find . -name 'd*' -print |");&lt;BR /&gt;while(&lt;INP&gt;) {&lt;BR /&gt; chomp;&lt;BR /&gt; if ($sz=-s $_ &amp;gt; $big) { $fil=$_ ; $big=$sz; }&lt;BR /&gt;}&lt;BR /&gt;system("/usr/bin/cancel ${prt}-".(0+substr($fil,4,4)));&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills&lt;/INP&gt;</description>
      <pubDate>Mon, 21 Apr 2003 20:34:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848178#M770896</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-04-21T20:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848179#M770897</link>
      <description>Here's the exact output from lpstat in JPG format...</description>
      <pubDate>Tue, 22 Apr 2003 11:22:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848179#M770897</guid>
      <dc:creator>Peter A. Berger Jr.</dc:creator>
      <dc:date>2003-04-22T11:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848180#M770898</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;lpstat -o | awk '/^AcctHold/{req=$1;getline;if ($(NF-1)&amp;gt;max){kreq=req;max=$(NF-1)}}END{system("cancel "kreq)}'&lt;BR /&gt;&lt;BR /&gt;should do it.&lt;BR /&gt;&lt;BR /&gt;rgds, Robin</description>
      <pubDate>Tue, 22 Apr 2003 11:34:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848180#M770898</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2003-04-22T11:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848181#M770899</link>
      <description>Robin - excellent AWKing!  that's a 10 in my book.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Tue, 22 Apr 2003 12:25:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848181#M770899</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2003-04-22T12:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848182#M770900</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;How is this print job being created?  Rather than canceling the print job after the fact, you may want to look at where it's being created and handle it there.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Mark</description>
      <pubDate>Tue, 22 Apr 2003 12:29:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848182#M770900</guid>
      <dc:creator>Mark Ellzey</dc:creator>
      <dc:date>2003-04-22T12:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848183#M770901</link>
      <description>Robin -- script worked great! The only issue I have now is that it doesn't run for normal users (ie: non-root). Gives me an error message about me not being the owner of the print job. Is there a way to run this script as ROOT (SUID?) so that it bypasses this error message? Thanks again. :)</description>
      <pubDate>Tue, 22 Apr 2003 12:50:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848183#M770901</guid>
      <dc:creator>Peter A. Berger Jr.</dc:creator>
      <dc:date>2003-04-22T12:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848184#M770902</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;This will always remove the largest job. &lt;BR /&gt;Printer = parameter&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;3 lines in total&lt;BR /&gt;&lt;BR /&gt;printer=$1&lt;BR /&gt;&lt;BR /&gt;cancel $printer"-"$(find /var/spool/lp/request/$printer -type f -name dA*|&lt;BR /&gt;&lt;BR /&gt;xargs du -s|sort -n|tail -n 1|sed -e 's/^.*dA//' |cut -c1-4)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                Steve Steel</description>
      <pubDate>Tue, 22 Apr 2003 12:55:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848184#M770902</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2003-04-22T12:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848185#M770903</link>
      <description>Hi Peter,&lt;BR /&gt;&lt;BR /&gt;I would probably incorporate sudo into the script, i.e. &lt;BR /&gt;&lt;BR /&gt;system("sudo cancel "kreq)&lt;BR /&gt;&lt;BR /&gt;If you haven't already got this utility, I'd recommend its use - it can be downloaded from:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.connect.org.uk/hppd/hpux/Sysadmin/sudo-1.6.6" target="_blank"&gt;http://hpux.connect.org.uk/hppd/hpux/Sysadmin/sudo-1.6.6&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;rgds, Robin</description>
      <pubDate>Tue, 22 Apr 2003 13:09:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848185#M770903</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2003-04-22T13:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848186#M770904</link>
      <description>If you need to cancel the same print job every day why not stop the print job from printing in the first place?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Apr 2003 13:23:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848186#M770904</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-04-22T13:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help for LP command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848187#M770905</link>
      <description>closed</description>
      <pubDate>Fri, 20 Oct 2006 06:50:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-for-lp-command/m-p/4848187#M770905</guid>
      <dc:creator>Peter A. Berger Jr.</dc:creator>
      <dc:date>2006-10-20T06:50:17Z</dc:date>
    </item>
  </channel>
</rss>

