We are using raspberry pi (Raspbian 8) computers as a print servers. To one raspberry can be connected up to four USB printers (zebra thermal printers). Printers can be unplugged/switched off/exchanged with other ones.
I need to create a bash script which will monitor connected printers and make a right mappings in CUPS - for example if printer was connected previously as a Zebra2 then it must always be Zebra2 even if it is now the only one printer connected.
I'm thinking about saving printers' serial numbers in file and use it in script for permanent mappings.
I can find connected printers with command: lpinfo -v
DeviceURI has the following look: usb://Zebra%20Technologies/ZTC%40SSS747?serial=22Y222222222