Am Dienstag, den 05.09.2006, 18:02 +0000 schrieb Noman yousuf:
> anselm
> thanks for yr email . i have all ldap users u can do a favour to give me 
> that script

I do not have access to it. And sorry, I am just preparing to move half
my household _and_ have a dozen customers nagging for an appointment - I
will not get around to write that anew *tidily*and*test*it*properly*.

Think along something like this (which is untested, and out of my head):

- Let's assume all printers you have are the same model, because that's
an easy assumption for now (get that done properly yourself, later,
please - I don't know wether at that point in the CUPS stream it's all
postscript or already preprocessed).

- Create all the printers, with names as you like
- Create an additional printer, same model, printer location
"/dev/lp0" (we will never actually print there, so don't worry), and the
printer name should be "next2u" (choose anything and change the script).

- Create a file "/etc/allprinters" world-readable, one entry per line,
like    terminaldisplayvariable:printername-to-use:
like    ws101:hplj4_001:

- Move /usr/bin/cupsdoprint to /usr/bin/cupsdoprint.real
- Create the following perl-script as /usr/bin/cupsdoprint and make it
executable-for-all (mode 755):
==== SNIP
#!/usr/bin/perl
my @a = @ARGV;
my $b;
my $c;
my $d;
# Check the display variable and find the appropriate printer
$c = $ENV{'DISPLAY'};
$c =~ s/\:.*//;
$c = `grep "^$c: /etc/allprinters | tail -1`;
if ( strlen ( $c ) < 1 ) { exit; } # If no printer can be found, abort.
$c =~ s/[^\:]*\://;
$c =~ s/\://g;
$d = "";
for ( $b = 1; $b < $a; ++$b ) {
        ### if ( $a[$b-1] == '-P' ) {
        if ( ( $a[$b-1] == '-P' ) && ( $a[$b] == 'next2u' ) ) {
                $a[$b] = $c;
        }
        $d = $d." \"".$a[$b]."\"";
}
system ( "/usr/bin/cupsdoprint.real".$d );
==== SNAP

Caution, this is untested and a cheap hack, might contain typos and
probably eat your goldfish.

If you want to forbid your users to choose a printer (they always print
to the next printer, reagardless what they choose), use the "### if"
line instead of the one following it. As shown above, only print jobs
sent to the "next2u" printer will be redirected, all others will go to
the printer that was selected by the user manually.

Could be adapted to select a printer per used, not per terminal, or
thousands options else.

I repeat: THIS IS UNTESTED. Please test if you like. Comment back.

I remember we did something quite similar back in 2004, but as I do not
have it at hand, I cannot help with that.

Hth
Anselm


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_____________________________________________________________________
Ltsp-discuss mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
For additional LTSP help,   try #ltsp channel on irc.freenode.net

Reply via email to