02-11-2014
I have a few observations. I apologies if listing them make it seem a little terse for a response, but I will end up in long winded discussion with myself otherwise.
- If you are planning on scheduling this, you will have to name the printer, and therefore run it for each printer. Would you consider looking at the output of lpstat -p (no other parameters) and taking action for each printer that is not in a good state?
.
- Why are you planning to cancel a print job? The output will be lost, when the most usual cause is a printer hardware issue, and the job will pick up later.
.
- Very pleased to see lots of logging for actions but your tail -50 /var/spool/lp/log may not get the information you are interested in. Perhaps use grep to select information about your print queue and then tail off the last few records.
.
- You are searching for state of Warning, but that doesn't cover a queue that is DOWN
These are observations only, and you certainly have the makings of a sensible approach. If it meets your needs, there is nothing else to do.
Robin
Last edited by rbatte1; 02-11-2014 at 01:09 PM..
Reason: ICODE tagging "DOWN" & splleling
8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a script that i need to run from different paths.
for example
mypc/path1/path2/,
mypc/path1/path2/path3/, and
mypc/path1/path2/path3/path4
How do i set up that script so that it can execute in any
of the above paths or how can i make it run on any path on my computer?? (5 Replies)
Discussion started by: dowell
5 Replies
2. Shell Programming and Scripting
Hi there all..
I need some help with a script I have.
It's a printing script but what will happen if the printer stays on disabled?
Will it continue in the loop?
How can I change the script so it will only loop like 5 times and if still not working than it send a e-mail with what printer has... (0 Replies)
Discussion started by: draco
0 Replies
3. AIX
Hello
Let me first give a small overview of the setup. All printers are connected to Windows 2000 servers. There are a lot of UNIX (AIX & HP-UX) servers as well which have SAP running.
I'm working on a script to add printers to a specified SAP instance. I want to verify the user input (to... (0 Replies)
Discussion started by: NielsV
0 Replies
4. Shell Programming and Scripting
Hi,
We check the printer status at the command line by giving the following command and the system gives an output;
lpstat -prn001_hp4000n
When I give the same command in a UNIX script the system gives an error while running the script as "lpstat: not found".
Please let me know... (8 Replies)
Discussion started by: jmathew99
8 Replies
5. Linux
Hi,
Is it possible to find the printer location and printer type (whether it is local or network) using command in Linux ?
Thanks in advance. (1 Reply)
Discussion started by: forumguest
1 Replies
6. AIX
Good day UNIX forum, could you help me with my clear printer queue script, i have problems with the consistency of this function, sometimes it works sometimes it doesn't. Thanks in advance
}
preRemovePrintQ(){
clear;
echo;
echo... (1 Reply)
Discussion started by: beware187
1 Replies
7. UNIX for Dummies Questions & Answers
Good afternoon. :)
I'm rather new to bash scripting, and have probably bitten off a bit more than I can chew to be honest, but I work in a service desk-like environment where one of the main complaints is that it takes our staff a long time to set up network printers on our clients' servers.... (3 Replies)
Discussion started by: aperfecthalo
3 Replies
8. Shell Programming and Scripting
Hello,
I need to chack if the printer is out of paper, and send message to operator.
I need to do this from perl script.
The printer have mechanism to check if it have paper. However, the cups does not report "printer out of paper" when I remove the paper, and try to print.
Is there any... (1 Reply)
Discussion started by: +Yan
1 Replies
lpq(1) General Commands Manual lpq(1)
Name
lpq - spool queue examination program
Syntax
lpq [ options ] [ job #... ] [ user... ]
Description
The command examines the spooling area used by for printing files on the printer, and reports the status of jobs. The command invoked
without any arguments reports on any jobs currently in the default queue.
When jobs are being printed, reports the queue as being ``active''. For each job submitted, reports the user's name, current rank in the
queue, the names of files comprising the job, the job identifier and the total size in bytes. The job identifier is a number which may be
supplied to to remove a specific job.
Job ordering is determined by the FIFO (First In, First Out) algorithm used to scan the spooling directory. When the queue is empty,
reports that there are ``no entries''.
File names may be unavailable for some jobs, for example, if the command is used without specifying a file name, or if is used in a pipe
line. If file names are unavailable, the file name reported by is ``standard input''.
Arguments
job #... Causes to report on only the job number(s) specified.
user... Causes to report on only the jobs for the specified user(s).
Options
+n Scan and display the spool queue until the queue is empty. The queue is scanned every n seconds, if no argument is specified the
queue is scanned every 30 seconds.
-l Display the status of each job on more than one line if necessary. If this option is not used, the status of each job is displayed on
one line.
-Pprinter
Report the status of the spool queue for the printer specified. If this option is not used, the spool queue displayed is the one
defined by the PRINTER environment variable. If a queue is not defined by the PRINTER environment variable, the spool queue displayed
is for the printer named ``lp'' in the file.
Restrictions
The displayed status of the spool queue may not always be the current status. This is because jobs may be completed after the queue has
been examined, but before the status has been displayed.
Error Messages
Two of the most common error messages from are:
Warning: no daemon present (R)
A daemon is not available for the specified printer. Refer to the command to find out how to restart the printer daemon.
unknown printer (R)
The printer specified as an argument to the -P option, doesn't have an entry in the file.
Files
For manipulating the screen for repeated display
To determine printer characteristics
The spooling directory, as determined from printcap
Control files specifying jobs
The lock file to obtain the currently active job
See Also
lpr(1), lprm(1), lpc(8), lpd(8)
lpq(1)