Setting Default Printers in LTSP

Finding a way to have client default to the closest network printer was fairly simply after finding this post on the edubuntu mailing 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

Advertisements

About Craig Szymanski

Systems Administrator Photography Enthusiast
This entry was posted in LTSP - Linux Terminal Server Project and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s