Cancel Printing Problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cancel Printing Problem
# 8  
Old 11-18-2011
Yes I have used lpstat..all I need is script to ask for printer and then show that qeues...
then it will allow me to cancel. That is what I need...
I can lpstat...but I need to put the rinter name'
# 9  
Old 11-18-2011
Lets try to ask previous questions another way:

What can you not do in your script?

The idea of this forum is NOT to do your work for you... but Assist / Help you do your work
# 10  
Old 11-18-2011
Yes What I cannot do is to get the printer name...or so..do I have to us read printer??? or set printer as a variable???
# 11  
Old 11-18-2011
OK
1) you print on screen the info you want the user to enter using echo command:
e.g.
Code:
 echo "Please enter the printer : "

Then to get the input, Yes! you use read:
Code:
 read NPRINTER

Now NPRINTER is the name of the variable containing the value entered, you will need $ sign in front of its name to use the value, in the other words what was entered is $NPRINTER...
to check by yourself:
Code:
echo " NPRINTER = " $NPRINTER

Now your turn to do a bit of work...

Courage!
# 12  
Old 11-18-2011
Do I need to use if else with this...to chech the printer?? and if no printer available then do other thing???
help needed

---------- Post updated at 10:26 AM ---------- Previous update was at 10:17 AM ----------

check this out dude...
Code:
#!/bin/bash
NLPrinter=Printer
echo " Please enter Printer Name"
read $NLPrinter
if [ $NLPrinter = "$#"  ]
        then
        lpstat -o
else
        lpstat
fi

Moderator's Comments:
Mod Comment Please use code tags when posting data and code samples, thank you.

Last edited by Franklin52; 11-19-2011 at 10:42 AM..
# 13  
Old 11-18-2011
Well if people need to cancel jobs, you do hope that the jobs exist in a queue...
I dont quite get your request...
Lets say you have a printer called lp1
Once the user will have entered lp1 and you read it, what will your script do with it?

Remember that a user has not enough privileges to cancel jobs he doesn't own (If that is the issue)

You are right in the sense a user could have had typos issues ( like me...), for that you would have to keep up to date a list of valid printer names to use and compare to the list or use something like:
Code:
 lpstat -t|grep lp1|wc -l

and see if greater than 0...
# 14  
Old 11-18-2011
Code:
#!/bin/bash
NLPrinter=""
echo " Please enter Printer Name"
read NLPrinter
if [ $NLPrinter = "$#" ]  # This I dont understand since you read the value what
then                      # are you going to compare it with?
   lpstat -o
else
   lpstat
fi

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

i want to cancel printing job

hi every body i used " lpstat -o" to show the printer jobs and i already canceld it by "cancel -e -f jobid" but the problem i found when used " lpstat -o" again it said that job in progress i think because it in the buffer but i don't know how to clear the printer. (9 Replies)
Discussion started by: maxim42
9 Replies

2. Shell Programming and Scripting

Problem with printing

Hi, i am writing a script to generate a summary report for my data text file my data in my text file goes like this: MacOS:Mary Abraham:53.48:88:38 Windows in lala:Mary Abraham:22.30:23:22 lala in Windows:John Goodman:33.60:121:12 Hello world:Mr Tian:23.30:23:10 Windows in 31 days:John... (2 Replies)
Discussion started by: Cheranime
2 Replies

3. SCO

Problem with printing

Does anybody know how I can stop the system slewing pages when a spool file has finished printing. I need to set up a method where all users are printing to the same printer to produce labels. The problem is that when the first users file has been printed the pages are slewed and the label is not... (2 Replies)
Discussion started by: rongrout
2 Replies

4. HP-UX

Printing problem

I have scheduled to print a numerous of report in mid-night. But, I found that some reports have not been printed out. Then, I checked the file /var/spool/lp/log and found that all reports have been submitted to print queue. Could anyone tell me what can be done to ensure all print jobs can be... (2 Replies)
Discussion started by: alfredo
2 Replies

5. UNIX for Advanced & Expert Users

Printing Problem

I am trying to print to an hp printer. i configured it using the hp configuration, entry is in the /etc/hosts file, i can telnet into it using port 9100, ping it and send jobs to it. it just won't print. the jobs stay in the spooler. its telling me to add the printer to the canaccess list. ... (0 Replies)
Discussion started by: Rosario
0 Replies

6. UNIX for Dummies Questions & Answers

Printing problem

Hello, Not sure where to begin on describing the issue; please try to understand that I am not very familiar with SCO UNIXWARE. I am a newbie... We have a SCO UNIXWARE version 7.4 when we restart the computer we are required to enter the command lpstart, without it; people cannot print. ... (1 Reply)
Discussion started by: Yorgy
1 Replies

7. UNIX for Dummies Questions & Answers

printing Problem

When I print a file from an application it never stops printing. Any ideas? (2 Replies)
Discussion started by: 744eagle
2 Replies

8. IP Networking

Printing Problem

I have a printer installed on sun solaris m/c sun os 5.8. It doesn't print more than 52 files i.e if a give lp *.txt and the curent folder contains more than 52 files then it doesn't print them but if print in batches , each containing 52 files then it prints them properly. How do i increase the... (3 Replies)
Discussion started by: kapilv
3 Replies

9. UNIX for Dummies Questions & Answers

printing problem

i can only print from unix when I am logged in as host. When any user logs in (even myself as a user who has root priviledges) I cannot print. Has anyone heard of this problem before and are there any troubleshooting tips out there. HELP......... (3 Replies)
Discussion started by: acarroll
3 Replies

10. UNIX for Dummies Questions & Answers

Problem with printing

Hi , Can somebody Please help me in finding out where I am going wrong. Suppose i have a file called r_wer which contains files. for ex : LMN20001 LMN20002 LMN20003 Now I want to print them. The way I am doing is $ for a in `cat '/r_wer'` > do > lp -d printername $a > done But... (3 Replies)
Discussion started by: rooh
3 Replies
Login or Register to Ask a Question