#!/usr/local/bin/perl #examin args foreach $arg (@ARGV) { next if /^-/; $printer = $arg; } #if arg was empty, set $printer to environment variable $printer = (defined $printer) ? $printer : $ENV{PRINTER}; #get spooler for $printer open(HES,"hesinfo $printer qhost|"); while() { chop; unless(/Hesiod name not found/) { $spooler = $_; } } #print out helpful message listing $printer and its spooler print "printer: $printer spooler: $spooler\n"; #get current realm CELL=glue.umd.edu $mycell = $ENV{CELL}; $printercell = ($spooler =~ /eng|glue/) ? "glue.umd.edu" : "wam.umd.edu"; #make current ticket env file appropriate to printer realm #see if user already has ticket for appropriate realm #if not, kinit if ($mycell ne $printercell) { $substr = ($mycell =~ /glue/) ? "wam" : "glue"; $filetest = "/tmp/tkt_".$substr."_".$ENV{USER}; unless (-e $filetest) { $kinitcmd = ($mycell =~ /glue/) ? "wkinit" : "gkinit"; system("$kinitcmd"); } $ENV{'KRBTKFILE'}=$filetest; } system("qstat @ARGV");