Copying Printer Config from one Apple Mac To Another

KB Home   |   Copying Printer Config from one Apple Mac To Another

Main.CopyingPrinterConfigOnTheMac History

Hide minor edits - Show changes to output

June 23, 2015, at 09:58 PM by Vanessa White - clarification on settings needed on the source mac
Changed line 11 from:
->'''1)''' Copy script (contents below) into a file called [@pull-printer-config.sh@] on a target system (the system that needs the printer config).
to:
->'''1)''' Copy script (contents below) into a file called [@pull-printer-config.sh@] on a target system (the system that needs the printer config). Verify that Remote Login is enabled on the Mac that currently has the printer configured for the admin user you'll be logging in as. You can enable Remote Login in System Preferences > Sharing > Remote Login.
August 08, 2011, at 01:19 AM by tom - update script for OS 10.[67] support, fix typos
Changed lines 7-8 from:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system to another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy (ssh) to pull and duplicate the printer configuration from a master/source system.  This script will work with most printers that use standard PPD based drivers, but may have problems with some drivers that use custom components (e.g. Epson wide-format printers).
to:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system to another will duplicate the printer configuration.  Mac OS X administrators may find the following shell script example useful.  It uses a secure shell (ssh) to pull and duplicate the printer configuration from a master/source system.  This script will work with most printers that use standard PPD based drivers, but may have problems with some drivers that use custom components (e.g. Epson wide-format printers).
Changed line 45 from:
   echo "    SOURCE: The remote system who's printer config you'd like to copy."
to:
   echo "    SOURCE: The remote system whose printer config you'd like to copy."
Changed line 68 from:
# On the target system take a copy of our cups config and set ourselfs as the
to:
# On the target system take a copy of our cups config and set ourselves as the
Changed line 72 from:
ssh "${SRC_USER}@${SRC_HOST}" \
to:
ssh -t "${SRC_USER}@${SRC_HOST}" \
Deleted line 108:
May 26, 2010, at 05:21 AM by 202.129.124.120 -
Changed lines 7-8 from:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system to another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy (ssh) to pull and duplicate the printer configuration from a master/source system.  This script will work with most printers that use standard PPD based drivers, but may have problems with some drivers that use custom components.
to:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system to another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy (ssh) to pull and duplicate the printer configuration from a master/source system.  This script will work with most printers that use standard PPD based drivers, but may have problems with some drivers that use custom components (e.g. Epson wide-format printers).
Changed line 113 from:
''Categories:'' [[!Scripts]], [[!TipsAndTricks]], [[!Mac]]
to:
''Categories:'' [[Category.Scripting|+]], [[Category.TipsAndTricks|+]], [[Category.Mac|+]]
Changed lines 115-116 from:

[-keywords: duplicate, deploy, automate printer configuration -]
to:
[-keywords: duplicate, deploy, automate printer configuration-]
Changed lines 44-45 from:
   echo "USAGE: pull-printer-config SOURCE [USER]" 1>&2
   echo "    SOURCE: The remote system who's printer config you'd like to copy." 1>&2
to:
   echo "USAGE: pull-printer-config SOURCE [USER]"
   echo "    SOURCE: The remote system who's printer config you'd like to copy."
Changed line 82 from:
# Use scp to copy our temp copy over to our local sustem.
to:
# Use scp to copy our temp copy over to our local system.
Changed lines 7-8 from:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system to another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy (ssh) to pull and duplicate the printer configuration from a master/source system.
to:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system to another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy (ssh) to pull and duplicate the printer configuration from a master/source system.  This script will work with most printers that use standard PPD based drivers, but may have problems with some drivers that use custom components.
Changed lines 23-24 from:
->'''Tip:''' Advanced administrators can take advantage of SSL host keys to avoid the need to enter a password.
to:
->'''Tip:''' Advanced administrators may choose to take advantage of SSL host keys and a custom /etc/sudoers file to avoid the need to enter a password.
Changed lines 7-8 from:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system to another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy (ssh) to pull and duplicate the printer configuration from a master system.
to:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system to another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy (ssh) to pull and duplicate the printer configuration from a master/source system.
Changed lines 23-24 from:
'''Tip:''' Advanced administrators can take advantage of SSL host keys to avoid the need to enter a password.
to:
->'''Tip:''' Advanced administrators can take advantage of SSL host keys to avoid the need to enter a password.
Changed lines 7-8 from:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system not another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy (ssh) to pull the printer configuration from a master system.
to:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system to another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy (ssh) to pull and duplicate the printer configuration from a master system.
Changed lines 11-14 from:
->'''1)''' Copy script (contents below) into a file called [=pull-printer-config.sh=] on a target system (the system that needs the printer config).

->'''2)''' Make sure the Printer Setup Utility is closed.
to:
->'''1)''' Copy script (contents below) into a file called [@pull-printer-config.sh@] on a target system (the system that needs the printer config).

->'''2)''' Make sure the ''Printer Setup Utility'' is closed.
Changed lines 7-8 from:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system not another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy to pull the printer configuration from a master system.
to:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system not another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy (ssh) to pull the printer configuration from a master system.
Deleted line 80:
Added line 87:
Changed line 113 from:
''Categories:'' [[!Scripts]], [[!TipsAndTricks]], [[Mac]]
to:
''Categories:'' [[!Scripts]], [[!TipsAndTricks]], [[!Mac]]
Changed line 104 from:
# Restart CUPSD
to:
# Restart the CUPS server so it picks up our new config.
Changed line 113 from:
''Categories:'' [[!Scripts]], [[!TipsAndTricks]]
to:
''Categories:'' [[!Scripts]], [[!TipsAndTricks]], [[Mac]]
Added lines 115-116:

[-keywords: duplicate, deploy, automate printer configuration -]
Changed lines 7-8 from:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system not another will duplicate the printer configuration.  Mac OS X administrators may find the following shell script example useful.  It uses secure copy to pull the printer configuration from a master system.
to:
This is a "hidden" system directory storing the CUPS configuration.  Recursively copying this directory from one system not another will duplicate the printer configuration.  Mac OSX administrators may find the following shell script example useful.  It uses secure copy to pull the printer configuration from a master system.
Changed lines 110-114 from:
=]
to:
=]

----
''Categories:'' [[!Scripts]], [[!TipsAndTricks]]
----
Changed lines 15-16 from:
->'''3)''' Open a command-prompt and [=cd=] to this directory.
to:
->'''3)''' Open a command-prompt and @@cd@@ to this directory.
Changed lines 26-27 from:
''Copy the contents below into a plain text file called =[pull-printer-config.sh=]''
to:
''Copy the contents below into a plain text file called'' [@pull-printer-config.sh@]
Added line 4:
Changed lines 6-7 from:
This is a "hidden" system directory storing the CUPS configuraitionRecursivily copying this directory from one system not another will duplicate the printer configuration.  Mac OS X administrators may find the following shell script example useful.  It uses secure copy to pull the printer configuration from a master system.
to:

This is a "hidden" system directory storing the CUPS configurationRecursively copying this directory from one system not another will duplicate the printer configuration.  Mac OS X administrators may find the following shell script example useful.  It uses secure copy to pull the printer configuration from a master system.
Changed lines 31-32 from:
# Script provided by PaperCut Software to copy printer configuration from
# one Apple Mac OS X system to another.
to:
# (c) Copyright PaperCut Software, 2007
Changed lines 33-37 from:
to:
# Author: Chris Dance (chris.dance <a> papercut.biz)
# A simple script to copy printer configuration from one Apple Mac OS X
# system to another.
#

Changed lines 1-2 from:
(:Copying Printer Config from one Apple Mac To Another:)
to:
(:title Copying Printer Config from one Apple Mac To Another:)
Added lines 1-105:
(:Copying Printer Config from one Apple Mac To Another:)

The printer configuration information on Mac OS X is stored in the directory:
->[@/etc/cups@]
This is a "hidden" system directory storing the CUPS configuraition.  Recursivily copying this directory from one system not another will duplicate the printer configuration.  Mac OS X administrators may find the following shell script example useful.  It uses secure copy to pull the printer configuration from a master system.

!!How to use:

->'''1)''' Copy script (contents below) into a file called [=pull-printer-config.sh=] on a target system (the system that needs the printer config).

->'''2)''' Make sure the Printer Setup Utility is closed.

->'''3)''' Open a command-prompt and [=cd=] to this directory.

->'''4)''' Run the script:
            sudo sh pull-printer-config.sh <sourcemachine> <adminuser>
-->where:
--->[@<sourcemachine>@] is the name or IP of the system who's printer config you'd like to copy.
--->[@<adminuser>@] is the name of an "admin" level account on the source system.  You will need to know the password associated with this account.

'''Tip:''' Advanced administrators can take advantage of SSL host keys to avoid the need to enter a password.

!!The script:
''Copy the contents below into a plain text file called =[pull-printer-config.sh=]''

 [=
#!/bin/sh
#
# Script provided by PaperCut Software to copy printer configuration from
# one Apple Mac OS X system to another.
#

TARGET_HOST=`hostname`
SRC_HOST=$1
SRC_USER=root

if [ -z "${SRC_HOST}" ]; then
    echo
    echo "USAGE: pull-printer-config SOURCE [USER]" 1>&2
    echo "    SOURCE: The remote system who's printer config you'd like to copy." 1>&2
    echo "    USER: An admin level user on the source system. If not defined root is used."
    echo
    exit 1
fi

if [ ! -z "$2" ]; then
    SRC_USER=$2
fi

userid=`id | sed "s/^uid=\([0-9][0-9]*\).*$/\1/"`
if test "${userid}" -ne 0; then
    echo "Error: Please run this script as root (e.g. sudo pull-printer-config)" 1>&2
    exit 1
fi


echo "Copying printer configuration from ${SRC_HOST} to ${TARGET_HOST}."
echo "Enter the password for the user ${SRC_USER} on ${SRC_HOST} if requested."
echo "You may be requested for your password multiple times."
echo

#
# On the target system take a copy of our cups config and set ourselfs as the
# owner.
#
echo "Preparing config on source server..."
ssh "${SRC_USER}@${SRC_HOST}" \
    "sudo sh -c \
    \"rm -fr /tmp/cupstmp; cp -R /etc/cups/ /tmp/cupstmp; chown -R ${SRC_USER} /tmp/cupstmp\""

if [ "$?" -ne "0" ]; then
    echo "Error: Unable to source config of remote system" 1>&2
    exit 1
fi


#
# Use scp to copy our temp copy over to our local sustem.
#
echo "Copying config..."

rm -fr /etc/cupstmp >/dev/null 2>&1
#
# Move old config
#
scp -rpq "${SRC_USER}@${SRC_HOST}:/tmp/cupstmp/" "/etc/cupstmp"
if [ ! -d /etc/cupstmp  ]; then
    #
    # Error so restore our backup
    #
    echo "Error: Unable to copy files." 1>&2
    exit 1
fi

datestamp=`date +%y%m%d`
mv /etc/cups "/etc/cups${datestamp}" && mv /etc/cupstmp /etc/cups

#
# Restart CUPSD
#
killall -HUP cupsd

echo "Copy complete."

=]

Comments

Share your findings and experience with other PaperCut users. Feel free to add comments and suggestions about this Knowledge Base article. Please don't use this for support requests.

Article last modified on June 23, 2015, at 09:58 PM
Printable View   |   Article History   |   Edit Article