#!/bin/sh # this script configures an hp5100 using its bonjour address as an example. # you should run this script as root or prefix it with sudo to avoid access issues. # also, to delete an existing printer config, use: lpadmin -x "printer name" # to check the status of all existing queues, use lpstat -a. check lpstat's man page for more options. # # -p is the printer name as seen on the client # -L is a location description, so add a real location if you want # -E enables the printer for use immediately # -v is the device uri. note the %20 ascii encoded spaces in the mdns uri ### for an appletalk queue, you'd want a uri like this: pap://*/PET/LaserWriter ### for a lpd queues, use something like: lpd://192.168.0.100/ # -P requires the full path to the ppd file. if there are spaces, be sure to quote the string. # -o printer-is-shared=false means printer sharing is disabled for the newly created queue. ### 10.5 clients default to enabling sharing for reasons unknown to me. # lpadmin -p HP5100 -L "HP5100" -E -v mdns://HP%20LaserJet%205100%20Series%20%5BC06988%5D._printer._tcp.local. -P "/Library/Printers/PPDs/Contents/Resources/HP LaserJet 5100 Series.gz" -o printer-is-shared=false # # for good measure, be sure to restart cupsd. # comment out one or the other depending on the target OS. # # this restarts the cupsd printing daemon under 10.4.x /System/Library/StartupItems/PrintingServices/PrintingServices restart # # this restarts the cupsd printing daemon under 10.5.x launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
Never been to CodeSnippets before?
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
add printers via lpadmin (See related posts)
You need to create an account or log in to post comments to this site.
Related Posts
» LightTPD with named Virtual ... in php lighttpd mac OS X
» Pretty PS1 Prompt for Bash in shell bash bashrc prompt
» Bash function to copy SSH DS... in ssh shell zsh bash
» How to flush the local DNS c... in lighttpd virtualhosting shell bash hosts dns cache
» Redirect all output to a sin... in shell bash logging
» Remove all but X most recent... in shell bash
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails