[Samba] Re: CUPS, APW
Jeff Hardy
hardyjm at potsdam.edu
Mon Dec 6 16:26:54 GMT 2004
Haha. It was that pesky newline. See below.
Everything works perfectly now. Thanks very much.
-Jeff
On Mon, 2004-12-06 at 11:14, Martin Zielinski wrote:
> Hello,
> you shouldn't need to restart samba.
>
> I'm using a C-programm as addprinter command, and do not need to restart
> samba.
> Samba does it by it's own, if it receives one or more lines of text from the
> script.
> You allways get these access denied errors, when no line is printed.
> I know nearly nothing about perl, but (just as an idea) the script output
> needs a newline at its end. I don't know, if perl does this automaticly.
>
> In doubt, take a look at a level 10 debug. You should see the output of your
> script.
>
> Bye,
>
> Martin
>
> On Monday 06 December 2004 16:29, Jeff Hardy wrote:
> > > | 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.
> >
> >
> >
> > #!/usr/bin/perl
> > #
> > # 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
> > addy
> > # param 6 : win9x location
> >
> > require '/usr/local/bin/smbapwlib.pl'; #some useful functions
> >
> > #take in args
> > $lpname=shift;
> > $shname=shift;
> > $portname=shift;
> > $drivername=shift;
> > $location=shift;
> > $win9x=shift;
> >
> > #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
> > $location");
> >
> > sleep 1;
> >
> > #print sharename to make the port look nice
> > #also supposed to cause samba to reload its config
> > print ("$shname");
# Change this to:
print ("$shname\n");
> >
> > #reload samba manually
> > system("/usr/bin/killall","-HUP","smbd");
> >
> > sleep 2;
> > }
>
> --
> Martin Zielinski mz at seh.de
> Software Development
> SEH Computertechnik GmbH www.seh.de
More information about the samba
mailing list