Tuesday, May 27, 2008

Exporting your Printer Configuration in Linux

Have you ever encounter when you need to transfer hundreds of printer configuration from one linux box to another, well I have fortunately I have found an article on the web on how to easily you can export those configurations.

Saving the Configuration File

When you save your printer configuration using Printer Configuration Tool, it creates its own configuration file that is used to create the /etc/printcap file that the printer daemon (lpd) reads. You can use the command line options to save or restore this file. If you save your /etc/printcap file and overwrite your existing /etc/printcap file with the saved file, your printer configuration will not be restored. Each time the printer daemon is restarted, it creates a new /etc/printcap file from the special Printer Configuration Tool configuration file. If you have configured a backup system for your configuration files, you should use the following method to save your printer configuration. If you added any custom settings in the /etc/printcap.local file, you should save it as part of your backup system also.

To save your printer configuration, type this command as root:

/usr/sbin/redhat-config-printer-tui --Xexport > settings.xml

Your configuration is saved to the file settings.xml.

If you save this file, you can restore your printer settings. This is useful if your printer configuration is deleted, you reinstall Red Hat Linux and do not have your printer configuration file anymore, or you want to use the same printer configuration on multiple systems. To restore the configuration, type this command as root:

/usr/sbin/redhat-config-printer-tui --Ximport <>

If you already have a configuration file (you have configured one or more printers on the system already) and you try to import another configuration file, the existing configuration file will be overwritten. If you want to keep your existing configuration and add the configuration in the saved file, you can merge the files with the following command (as root):

/usr/sbin/redhat-config-printer-tui --Ximport --merge <>

Your printer list will then consist of the printers you configured on the system as well as the printers you imported from the saved configuration file. If the imported configuration file has a print queue with the same name as an existing print queue on the system, the print queue from the imported file will override the existing printer.

After importing the configuration file (with or without the merge command), you must restart the printer daemon with the command /sbin/service lpd restart or by starting Printer Configuration Tool and clicking Apply.

No comments: