[Samba] Re: CUPS, APW

Jeff Hardy hardyjm at potsdam.edu
Mon Dec 6 15:29:13 GMT 2004

> | I am left with two problems... the Access Denied error,
> | and the requirement for an external daemon to restart
> | Samba to complete the process.  It works, but I seem to
> | be missing something.
> A simple kill -HUP <pid> is enough.  You shouldn't restart
> smbd.

Thanks again.  I had previously done this but switched to a restart for
some reason.

Here is a stripped down version of my Perl addprinter script, for what
it is worth.  When I looked into this before, I didn't find many
examples so maybe it is of some use.  Trying to nail that Access Denied
problem... if you could, can you please tell me if you see anything
wrong or missing?

Thanks again for all your help.

# param 1 : printer name
# param 2 : share name   -> become the printer name for CUPS
# param 3 : port name
# param 4 : driver name
# param 5 : location     -> the device uri of the printer, probably IP
# param 6 : win9x location

require '/usr/local/bin/smbapwlib.pl';  #some useful functions

#take in args

#if queue exists, don't do anything
#this is because addprinter command is run each time printer modified
if (!(&checkqueue($shname))){		

        $shname = uc($shname);

        #check for location syntax
        #if no protocol specified...
        if ($location !~ m#:/#){
                #assume an lpd printer
                $location = "lpd://".$location;

	#run the cups lpadmin command to add the printer
        system("/usr/sbin/lpadmin -p $shname -D \"$drivername\" -E -v

	sleep 1;

        #print sharename to make the port look nice
        #also supposed to cause samba to reload its config
        print ("$shname");

        #reload samba manually

        sleep 2;

More information about the samba mailing list