- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- scripting help for LP command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 11:52 AM
04-21-2003 11:52 AM
lpstat -o
cancel AcctHold_1-#### (where #### is the print job having the largest kb size)
enable AcctHold_1 (and wait 30sec)
disable AcctHold_1
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 11:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 12:40 PM
04-21-2003 12:40 PM
Re: scripting help for LP command
lpstat AcctHold_1
Next, is the the name of the large file being printed always the same?
Is the size of the large file always the same?
Does the large file always get submitted at the same time?
That would make it easier - else you'll have to do some comparing with AWK....
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 01:34 PM
04-21-2003 01:34 PM
Re: scripting help for LP command
$prt="AcctHold_1";
chdir("/var/spool/lp/request/$prt");
open(INP,"/usr/bin/find . -name 'd*' -print |");
while(
chomp;
if ($sz=-s $_ > $big) { $fil=$_ ; $big=$sz; }
}
system("/usr/bin/cancel ${prt}-".(0+substr($fil,4,4)));
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 04:22 AM
04-22-2003 04:22 AM
Re: scripting help for LP command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 04:34 AM
04-22-2003 04:34 AM
Re: scripting help for LP command
lpstat -o | awk '/^AcctHold/{req=$1;getline;if ($(NF-1)>max){kreq=req;max=$(NF-1)}}END{system("cancel "kreq)}'
should do it.
rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 05:25 AM
04-22-2003 05:25 AM
Re: scripting help for LP command
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 05:29 AM
04-22-2003 05:29 AM
Re: scripting help for LP command
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.
Regards,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 05:50 AM
04-22-2003 05:50 AM
Re: scripting help for LP command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 05:55 AM
04-22-2003 05:55 AM
Re: scripting help for LP command
This will always remove the largest job.
Printer = parameter
3 lines in total
printer=$1
cancel $printer"-"$(find /var/spool/lp/request/$printer -type f -name dA*|
xargs du -s|sort -n|tail -n 1|sed -e 's/^.*dA//' |cut -c1-4)
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 06:09 AM
04-22-2003 06:09 AM
Re: scripting help for LP command
I would probably incorporate sudo into the script, i.e.
system("sudo cancel "kreq)
If you haven't already got this utility, I'd recommend its use - it can be downloaded from:
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/sudo-1.6.6
rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 06:23 AM
04-22-2003 06:23 AM
Re: scripting help for LP command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2006 11:50 PM
10-19-2006 11:50 PM