By crmanski
Finding a way to have client default to the closest network printer was fairly simply after finding this post on the edubuntu mail ing list…
https://lists.ubuntu.com/archives/edubuntu-users/2007-January/000600.html
This post suggested editing the /etc/profile logon script and adding something like this…
case `echo $DISPLAY | sed s/:.*$//` in
ws004) lpoptions -d printerA;;
ws005) lpoptions -d printerB;;
esac
In this example ws004 is determined by the $DISPLAY variable. This is not useful in the Ubuntu version of ltsp and it was suggested in that post that I use $SSH_CLIENT instead. So after playing around with what the $SSH_CLIENT variable gave me I realized that I am not as familiar with sed as I am awk. So after realizing that $SSH_CLIENT gives me an IP address first and then some other information. I just used awk to print out the first section of the echo command like this…
case `echo $SSH_CLIENT | awk ‘{print $1}’` in
192.168.0.20) lpoptions -d Room-220-Laser;;
192.168.0.21) lpoptions -d Room-120-Laser;;
esac