Add Printers Via Network Script

From ubermix Wiki
Revision as of 08:42, 5 February 2013 by Cytochromec (talk | contribs) (Created page with "If you have set up your ubermix computers to run the .network-autostart script and look for an update.sh when they boot up, you can do updates and customization. One option is...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If you have set up your ubermix computers to run the .network-autostart script and look for an update.sh when they boot up, you can do updates and customization. One option is to have the correct printer pushed out to a computer based on its hostname.

Prerequisites:

  • Network-autostart file set up on your image
  • Computers are named with some convention based on location. This can be set after imaging, by choosing Advanced Options (5) and then Set device hostname (5). For example the convention, SCHOOLABBREVIATION-ROOM-COMPUTERNUMBER, would have computers named CES-A2-01 for a computer at Central Elementary School in Room A2.

First determine the correct printer driver

Open a terminal (ctrl-alt-t) and type

lpinfo --make-and-model 'Part of your printer model name here' -m

For example

lpinfo --make-and-model '1022n' -m 

Will find the drivers for the HP Laserjet 1022n You will see a long list of text for multiple drivers, but the top one is the recommended driver foo2zjs:0/ppd/foo2zjs/HP-LaserJet_1022n.ppd HP LaserJet 1022n Foomatic/foo2zjs-z1 (recommended) drv:///hpijs.drv/hp-laserjet_1022n-hpijs-pcl3.ppd HP LaserJet 1022n hpijs pcl3, 3.12.6, requires proprietary plugin drv:///hpijs.drv/hp-laserjet_1022n-hpijs-zjs.ppd HP LaserJet 1022n hpijs zjs, 3.12.6, requires proprietary plugin drv:///hpcups.drv/hp-laserjet_1022n-pcl3.ppd HP LaserJet 1022n pcl3, hpcups 3.12.6, requires proprietary plugin drv:///hpcups.drv/hp-laserjet_1022n-zjs.ppd HP LaserJet 1022n zjs, hpcups 3.12.6, requires proprietary plugin foo2zjs:0/ppd/foo2zjs/HP-LaserJet_1022nw.ppd HP LaserJet 1022nw Foomatic/foo2zjs-z1 (recommended) drv:///hpijs.drv/hp-laserjet_1022nw-hpijs-pcl3.ppd HP LaserJet 1022nw hpijs pcl3, 3.12.6, requires proprietary plugin drv:///hpijs.drv/hp-laserjet_1022nw-hpijs-zjs.ppd HP LaserJet 1022nw hpijs zjs, 3.12.6, requires proprietary plugin drv:///hpcups.drv/hp-laserjet_1022nw-pcl3.ppd HP LaserJet 1022nw pcl3, hpcups 3.12.6, requires proprietary plugin drv:///hpcups.drv/hp-laserjet_1022nw-zjs.ppd HP LaserJet 1022nw zjs, hpcups 3.12.6, requires proprietary plugin

You then copy the first bit of text all the way to .ppd In the laserjet example you would copy the following text and paste it in a text file for later foo2zjs:0/ppd/foo2zjs/HP-LaserJet_1022n.ppd

Second determine your printer ip address

Usually printers are set up with static IP addresses. If so you can ask your IT team for a list of IP addresses for printers. Also most printers will print out their configuration or have a display that will show the configuration. Printer IP addresses will be a series of 4 numbers separated by periods. For example, 10.6.64.103 Once you have the IP address you are ready to push out printers over the network

Edit the script

Here is the basic script that you can change with your site information. The terminal command that will add a printer looks like this:

lpadmin -p RoomA2 -v socket://10.6.64.103:9100 -m foo2zjs:0/ppd/foo2zjs/HP-LaserJet_1022n.ppd -L "Room A2" -E

Replace 4 pieces of information as shown below.

lpadmin -p ReplaceWithPrinterName -v socket://put-IP-address-here:9100 -m put-driver-.ppd-file-here -L "Put the location here" -E

  1. !/bin/bash

if [ ! -e /etc/cups/updated2.txt ] then if grep CES-A2 /etc/hostname then lpadmin -p RoomA2 -v socket://10.6.64.103:9100 -m foo2zjs:0/ppd/foo2zjs/HP-LaserJet_1022n.ppd -L "Room A2" -E lpadmin -d RoomA2 elif grep CMS-D1 /etc/hostname then lpadmin -p RoomD1 -v socket://10.6.64.106:9100 -m foo2zjs:0/ppd/foo2zjs/HP-LaserJet_1022n.ppd -L "Room D1" -E lpadmin -d RoomD1 elif grep CMS-D8 /etc/hostname then lpadmin -p RoomD8 -v socket://10.6.64.102:9100 -m foo2zjs:0/ppd/foo2zjs/HP-LaserJet_Pro_P1606dn.ppd -L "Room D8" -E lpadmin -d RoomD8 fi sudo echo > /etc/cups/updated2.txt fi