Archive for June, 2018

h1

Using Shell Scripts to make Mac Printing easier

June 12, 2018

Mac printing has never been as easy as Windows printing. Some people say that is because Mac users don’t need as much support, and that may be true. But they will also say that the Printer Manufacturers don’t treat them as well as their Windows brethren. The Mac drivers are too often treated like an afterthought. They may not have all the features that the Windows Driver has for the same exact printer. The other thing that makes it harder is that Macs don’t typically print through a Print Server and if they do it is simply a pass through. The Windows Server doesn’t enhance the printing experience for the Mac user like it does for the Windows Users.

I did not set out to learn Unix Shell Scripting. I set out to be able to make configuring the defaults and options on a Mac printer easier. I have known about the CUPS Web Interface (http://127.0.0.1:631 ) for many years. I learned about CUPS from my Unix and Linux training. When the MAC OS X was released we learned it sat on top of Darwin Unix. Originally Apple used LPRng as the printing subsystem but moved to CUPS (Common Unix Printing System) when they released 10.2. This broke Mac printing for most users. But because of my familiarity with CUPS I was able to help my customers get their printers back up and printing. We knew how to get into the CUPS Web Page and modify the printer or set the defaults for that MAC, but it was just for the MAC you were on. If you have a large or even a moderate size group of Mac Users that could be a lot of work. That is what got me looking at shell scripts.

The first clue for me came from a System Engineer that I work with, Ned Bannan. He had a customer that had modified a ppd in CUPS and then compared it to the original to see what & where the changes were reflected in the ppd. He used the fc (file compare) command. I thought that was pretty cool. Then I found that I could use the lpoptions command to display all the options a ppd had, and JUST show me the options. We used to open the ppd with a text editor to find what options were available but then you get the entire ppd not just the options. It was shall we say “busy”. With the lpoptions command we got a neat and clean list of options.

Now that I can clearly see what options can be set and modified I began to test this with the lpadmin command. lpadmin, lpoptions, lpstat are all Unix commands. This is where we really begin to leverage the power of Unix to make Mac printing easier. lpstat will show me the printers that are installed on a particular Mac, lpotions show me the options and defaults that I can set in the ppd. lpadmin lets me not only set the options but also create a printer and its port on a Mac OS X. This is all great, but it is still a lot of typing on each Mac.

That is what led me to Unix Shell Scripts. Shell scripts are not that different than DOS BAT files. I remember years ago creating a BAT file for a customer that wanted to transfer files we had scanned in a remote office to a folder in their home office across a dial up connection. My BAT file worked so well that the next time I visited the customer the Company that sold them their Document Management System (DMS) had put their own Icon on my Bat file. They should have at least kissed me first, don’t you think? You could argue that Shell Scripts are more powerful than BAT files but they both do the same function on different OSes. They allow you to string together different commands to accomplish a task that otherwise would require a lot of typing. They are a godsend!

Unix Shell scripts make MAC printing easier for IT Managers.
Now I can create a Shell Script that configures an existing printer. I can create a Shell Script that can add a printer, an lpr port, and pull the ppd from an smb share. This script actually asks the End User two questions. What do you want to name your new HP Printer (or Canon, etc.) and What is the IP Address of the Printer. You could put this information along with a zip copy of the script in an email blast to your end users. It is amazing what you can do with Unix Shell Scripts!

That’s My $0.02
Vince McHugh
vince.mchugh@yahoo.com
http://www.necs.biz

Advertisements