Skip to main content

RHEL Move Printers

To migrate all or most the printers from one system to another, run the following commands on the old system:

Copy all the files in /etc/cups/ppd to a temporary location.

scp /etc/cups/ppd/*.ppd newsys:/tmp/

Create a list of all the printers on the old system. Copy file to new system

lpstat -v > /tmp/cups-printers.txt
scp /tmp/cups-printers.txt newsys:/tmp/cups-printers.txt

Copy the lpoptions file to a temporary location

scp /etc/cups/lpoptions newsys:/tmp/lpoptions

On the new system:

Create a script to read the printers file and create the devices on the new system.

cat /tmp/cups-printers.txt \
| sed -e 's/device for //' -e 's/: / /'  \
| ( while read p u; do 
      if [ -e /tmp/${p}.ppd ]; then
          echo lpadmin -p ${p} -P /tmp/${p}.ppd -v ${u} -E
      else
          echo lpadmin -p ${p} -v ${u} -E
      fi
  done) > create-prints.sh

Verify the create-printers.sh and then run it.

chmod +x ./create-prints.sh
./create-prints.sh

Copy the CUPS options.

cat /tmp/lpoptions >> /etc/cups/lpoptions