- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- check lp status
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
Discussions
Discussions
Forums
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
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
тАО11-20-2001 05:55 AM
тАО11-20-2001 05:55 AM
HPUX 10.20 and 11.00 on K series, L series, and N series.
Trying to develop a script for checking the status of print jobs. What I am looking for is to have a script notify me if there are jobs in the queue that are over 3 hrs old.
Taking a whack at developing a perl script to assist me in doing this but I also am needing the script to display and calculate the time differences.
My whack at the perl script is attached.
Essentially, how can I display the listing in a long format? Doing this will provide the date/time of the files and then how to do the math for the dates that are displayed with the files?
Many thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 06:09 AM
тАО11-20-2001 06:09 AM
Re: check lp status
http://www.deadcat.net/
search for:
chkprt.sh
or attached
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 08:07 AM
тАО11-20-2001 08:07 AM
Re: check lp status
The time manipulations in this assume EST.
MONTH=$(TZ=GMT+8 date +%b)
DAY=$(TZ=GMT+8 date +%d)
HOUR=$(TZ=GMT+8 date +%H)
lpstat -t | grep -| grep -v enabled| while read JOB j1 j2 j3 J_MON J_DAY J_TIME junk
do
J_HOUR=${J_TIME%:*}
if [[ $MONTH != $J_MON || $DAY != $J_DAY || $HOUR -gt $J_HOUR ]]
then
cancel $JOB
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 08:21 AM
тАО11-20-2001 08:21 AM
Re: check lp status
Not looking to cancel the jobs as this would be up to the client.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 08:35 AM
тАО11-20-2001 08:35 AM
Re: check lp status
And read in USER instead of j1.
Did I miss anything else?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 08:37 AM
тАО11-20-2001 08:37 AM
SolutionAs I see, you want to see all print jobs older than 3 hours. Is that it? If that's the case, you can test the time stamp on your printer queue control files with perl's 'stat' command and compare them to your localtime. Like this:
$mtime = (stat($filename))[8];
if ((time() - $mtime) > (3*3600)) {
print "file $filename is older than 3 hours\n"
}
Make sure you put this test inside your loop to test every control file on /var/spool/lp/request/printername/c*
Regards,
Paga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 09:48 AM
тАО11-20-2001 09:48 AM
Re: check lp status
Here is a 3 minute perl script which should be close. It lists those in the queue over 3 hours old plus a readable date stamp.
Clay