Is there a way to script adding a CUPS/TCPIP printer at startup via a bash script based on a CSV file? For instance, the file would have _IGEL client hostname;printer name;IP address_. At boot, the appropriate printer would be created. We are manually adding printers to each device, and I’m trying to find a better way of handling it. PrinterLogic and the likes is off the table right now thanks to covid.
I just posted something to find all network printers and “auto-magic” add them…
I saw that, which prompted me to inquire again. We have literally hundreds of printers, and each room has its own dedicated printer, so we wouldn’t want to add them all to each device.
@member So, modify my profile to read from your CSV file.
Here is output from /usr/lib/cups/backend/snmp for my network printer (Brother MFC-L2750DW)
network “Brother MFC-L2750DW series” “Brother MFC-L2750DW series” “MFG:Brother;CMD:PJL,PCL,PCLXL,URF;MDL:MFC-L2750DW series;CLS:PRINTER;CID:Brother Laser Type1;URF:W8,CP1,IS4-1,MT1-3-4-5-8,OB10,PQ3-4-5,RS300-600-1200,V1.4,DM1;” “”
Command to add above printer:
You would loop looking for hostname match and if found then add printer via… lpadmin….
Let me know if you need some help writing the script.
Thank you – I’m going to have to dive into that next week to see if I can come up with something. I know next to no bash, which is my real issue.
I will create a profile for you to test with this weekend. I will have it to you on Monday.
It will have an input file of this format:
Then “all” you have to do is to create the input file to collect URI for each printer via SNMP
This goes without saying, but thanks a ton – this is all very much appreciated!
@member — Dude… Here you go
Let me know if you have any questions or want a quick Zoom session to demo / discuss things.
This works beautifully, thank you so much! Oddball question, but if we go this route, and wind up with 1000+ entries in the config, how inefficient do you think that could be? That’s my only concern right now, that it would take too long to process. I was initially going to manage the CSV file outside of the profile, and just attach it to the profile rather than creating it within, but this would work just fine.
@member That should not be an issue (maybe a second or two to run). BUT… It may be best to have several of these profiles based on campus / site.
Got it. Thanks again, this is beautiful.
We have one that is Centralized on a Server but I did not write it so I can not share the code. But working on several things like local printers auto configuration, something like Plug and Play for local printer where I only support Cert models of printers. I have had to pause on the project due to other things taking priority but would love to hear what or how you would do it.
@member Here is the note on printing (office or home) — igelcommunity.slack.com/archives/C8GP9JHQE/p1600013349276900
Thanks, I believe I saved that one, will have to check it out.
Continue reading and comment on the thread ‘How to script adding a CUPS/TCPIP printer at startup via a bash script based on a CSV file on IGEL OS?’. Not a member? Join Here!
Learn more, search the IGEL Knowledge Base
Ask a question or comment on the above message thread?Join or log in to the IGEL Community to ask us anything and meet other IGEL customers, partners, and EUC enthusiasts.
Submit a question, or Join Today!