1833027 Members
2759 Online
110049 Solutions
New Discussion

printer spools

 
SOLVED
Go to solution
Norman_21
Honored Contributor

printer spools

Hi guys,

I run an application that sends the output to particular printers. One of those printers has stop working and print jobs for that particular printer is pending.Could anyone please advise how can I forward those printer jobs to another printer name.
when I issue the lpstat -o or just lpstat I see the print jobs but I need someone to advise the steps to fwd them to another printer.
Thanks and appreciate your support.

"Attitudes are contagious, is yours worth catching"/ My first point was given by SEP on January 31, 2003
12 REPLIES 12
Stefan Farrelly
Honored Contributor
Solution

Re: printer spools

use lpalt (see man lpalt)

eg. lpalt -d
Im from Palmerston North, New Zealand, but somehow ended up in London...
RAC_1
Honored Contributor

Re: printer spools

You can do from your application.
From Unix side you can use
lpalt command.(can move a request at a time)

lpmove to move all requests.
There is no substitute to HARDWORK
Leif Halvarsson_2
Honored Contributor

Re: printer spools

Hi

lpmove

You must shut down the spooler before (lpshut) and restart (lpsched).

Look at man lpmove.
Norman_21
Honored Contributor

Re: printer spools

Thanks guys for the quick reply, it is worked fine. However, I wonder if I can write a script to prompt the user for the source printer and destination printer. Could anyone advise.

Thanks again.
"Attitudes are contagious, is yours worth catching"/ My first point was given by SEP on January 31, 2003
RAC_1
Honored Contributor

Re: printer spools

Is the printer you are talking about locally connected or connected through print server? If it is connected to print server or if it is network printer then you can put script as follows

ping to printer ip, if fails redirect the print to other printer.

Regards,
There is no substitute to HARDWORK
Norman_21
Honored Contributor

Re: printer spools

thanks ANIL,

The printer is networked. however, what I want to do is something like that.

Example:

echo "please enter the printer ID you want to transfer?\c"
read ANSW
lpalt $ANSW -dprn085

Now, is it possible to set a variable for the target printer so that the user can enter other printer number as desired?
appreciate your feed back.

"Attitudes are contagious, is yours worth catching"/ My first point was given by SEP on January 31, 2003
Pete Randall
Outstanding Contributor

Re: printer spools

Hi,

I mangled a printer selection script that I had toyed with a couple years ago to approximate what you're looking for. I didn't get to test it but I think you can make something out of it:




function moveit
{
lpalt $printer -dprn085


echo "**** please enter the printer ID you want to transfer? ****"
echo "****

PS3="Enter your printer selection"
select printer in "CRQMS1" "CRQMS2" "CRQMS3" "crlzr1" "CLASS_HPIII" "DHS_HP4SIMX
" "SP_HP4SIMX" "Exit"
do
case $printer in
"CRQMS1" )
printit
"CRQMS2" )
printit
"CRQMS3" )
printit
"crlzr1" )
printit
"CLASS_HPIII" )
printit
"DHS_HP4SIMX" )
printit
"SP_HP4SIMX" )
printit
"Exit" )
echo exiting...
exit 0;;
* )
echo "The printer you selected is not valid"
echo "Please try again"
esac




Hope this helps,
Pete

Pete
Pete Randall
Outstanding Contributor

Re: printer spools

Actually, to do what you asked, you'll need another case statement for the output printer, then your "moveit" function would become "lpmove $printer $outprinter".

And the function should have a trailing } after it - got lost in the translation, I guess.

Pete

Pete
Pete Randall
Outstanding Contributor

Re: printer spools

Hmmmm, now that I look at it - the whole script is nothing but bugs. Until I can post a cleaned up version (or someone else posts a better one), consider it pseudo-code.

Sorry,
Pete

Pete
Pete Randall
Outstanding Contributor

Re: printer spools

OK, let's try this again:

function moveit
{
lpalt $printer -d$outprinter

}
echo "**** please enter the printer ID you want to transfer?
****"
echo "****

PS3="Enter your printer selection"
select printer in "CRQMS1" "CRQMS2" "CRQMS3" "crlzr1"
"CLASS_HPIII" "DHS_HP4SIMX
" "SP_HP4SIMX" "Exit"
do
case $printer in
"CRQMS1" )
moveit ;;
"CRQMS2" )
moveit''
"CRQMS3" )
moveit ;;
"crlzr1" )
moveit ;;
"CLASS_HPIII" )
moveit ;;
"DHS_HP4SIMX" )
moveit ;;
"SP_HP4SIMX" )
moveit;;
"Exit" )
echo exiting...
exit 0;;
* )
echo "The printer you selected is not valid"
echo "Please try again"
esac



As before, you need to add the second case statement to determine the $outprinter, but that should be closer to functional.

(Nothing like debugging your lousy coding in public to build your ego, is there?)

Pete

Pete
Pete Randall
Outstanding Contributor

Re: printer spools

Arrgghh! Just looked at it again - the lpalt command should have been lpmove.

Pete

Pete
Norman_21
Honored Contributor

Re: printer spools

Thanks Pete for the script!!!
"Attitudes are contagious, is yours worth catching"/ My first point was given by SEP on January 31, 2003