hey I am running Samba 2.2.8 on FreeBSD4.8, and all is working well, except: I have set up a virtual printer using Samba to take a print job, turn it into a pdf and then email it back to an address, using a perl script and the Samba print command. I have tested the script logging in as the Samba guest user and it works fine, but when i try to print to the printer it never works: the script is called, and gets as far as: Variables Set (see script below), but the pdf file is never generated. The spool IS cleared however. hmm. After much head scratching i restarted the smbd daemon, and suddenly it worked. Why? Now, every time i boot the machine i get the same problem: initially the virtual printer will not generate the pdf file, but will clear the spool, and after restarting smbd everything works as it should. Can anyone help? ------------------smb.conf------------------------- [global] workgroup = GROUP server string = FreeBSD TestBox security = SHARE encrypt passwords = Yes log file = /var/log/samba_log.%m max log size = 50 guest account = pcguest [tmp] comment = Temporary file space path = /tmp read only = No guest only = Yes guest ok = Yes [PDF Printer] comment = prints to PDF file path = /var/spool/samba guest ok = Yes printable = Yes printing = sysv print command = /usr/bin/printnew.pl %s %s> /tmp/log lpq command lprm command ----------------printnew.pl------------------------- #!/usr/bin/perl use Mail::Sender; my $print_location = '/var/spool/samba/'.shift(); my $print_job = shift(); my $ps2pdf_location = '/usr/local/bin/ps2pdf'; my $output_location = '/var/spool/samba/perl-output.pdf'; my $smtp_server = '1.1.1.1'; my $msg_subject = 'subject'; my $msg_body = 'This is a pdf attachment.'; my $from_address = 'whatever@blah.com'; my $auth_user = 'user'; my $auth_pass = 'pass'; my $to_address = 'whatever@blah.com'; print "Variables set.\n"; @ps2pdfcmd = ($ps2pdf_location, $print_location, $output_location); system(@ps2pdfcmd) == 0 or die "system @ps2pdfcmd failed: $?"; print "PDF generated.\n"; $sender = new Mail::Sender { smtp => $smtp_server, from => $from_address }; if ($sender->MailFile({ to => $to_address, subject => $print_job, msg => $msg_body, file => $output_location, auth => 'LOGIN', authid => $auth_user, authpwd => $auth_pass }) < 0) { die "$Mail::Sender::Error\n"; } print "Mail sent to $to_address successfully.\n"; @rmcmd = ("rm", $print_location, $output_location); system(@rmcmd) == 0 or die "system @rmcmd failed: $?"; print "Spool cleared.\n";
Joel Hammer
2003-Mar-19 21:58 UTC
[Samba] Samba print command only works on restart, help!
I guess the question is, is the same command used to start smbd at boot as is used after boot? Beware those complicated startup scripts. Joel
hey i am starting smbd using the supplied start script, but basically it just calls: smbd -D every time i start the computer i get the following error message however, even when the network cable is unplugged: [2003/03/20 11:23:47, 0] nmbd/nmbd.c:main(795) Netbios nameserver version 2.2.8 started. Copyright Andrew Tridgell and the Samba Team 1994-2002 [2003/03/20 11:23:51, 0] nmbd/nmbd_responserecordsdb.c:find_response_record(235) find_response_record: response packet id 8644 received with no matching record. [2003/03/20 11:23:51, 0] nmbd/nmbd_responserecordsdb.c:find_response_record(235) find_response_record: response packet id 8645 received with no matching record. does anyone know what causes this? thanks for your help. ----- Original Message ----- From: "Joel Hammer" <Joel@HammersHome.com> To: "Richard" <rhw@shspost.co.uk>; <samba@lists.samba.org> Sent: Wednesday, March 19, 2003 9:58 PM Subject: Re: [Samba] Samba print command only works on restart, help!> I guess the question is, is the same command used to start smbd at boot as > is used after boot? Beware those complicated startup scripts. > Joel > > >
Joel Hammer
2003-Mar-21 01:34 UTC
[Samba] Samba print command only works on restart, help!
Just guessing here: During startup, the path available to the shell environment is fairly limited. This will sometimes cause file not found errors during bootup. Maybe something weird is happening because of a path problem. Is the samba script being started in the right sequence? You might try adding the startup command to run last in the boot sequence. You could put it into /etc/rc.d/rc.local or its equivalent. You might just replace the current startup script with: killall smbd killall nmbd smbd -D nmbd -D You will need the complete path for the daemons, likely. Joel On Thu, Mar 20, 2003 at 11:29:21AM -0000, Richard wrote:> hey > > i am starting smbd using the supplied start script, but basically it just > calls: > > smbd -D > > every time i start the computer i get the following error message however, > even when the network cable is unplugged: > > [2003/03/20 11:23:47, 0] nmbd/nmbd.c:main(795) > Netbios nameserver version 2.2.8 started. > Copyright Andrew Tridgell and the Samba Team 1994-2002 > [2003/03/20 11:23:51, 0] > nmbd/nmbd_responserecordsdb.c:find_response_record(235) > find_response_record: response packet id 8644 received with no matching > record. > [2003/03/20 11:23:51, 0] > nmbd/nmbd_responserecordsdb.c:find_response_record(235) > find_response_record: response packet id 8645 received with no matching > record. > > does anyone know what causes this? > > thanks for your help. > > > ----- Original Message ----- > From: "Joel Hammer" <Joel@HammersHome.com> > To: "Richard" <rhw@shspost.co.uk>; <samba@lists.samba.org> > Sent: Wednesday, March 19, 2003 9:58 PM > Subject: Re: [Samba] Samba print command only works on restart, help! > > > > I guess the question is, is the same command used to start smbd at boot as > > is used after boot? Beware those complicated startup scripts. > > Joel > > > > > > > > -- > To unsubscribe from this list go to the following URL and read the > instructions: http://lists.samba.org/mailman/listinfo/samba
hey the script is already in /usr/local/etc/rc.d/ and is the last thing called. i have tried changing the script to start the daemon then kill it then restart it again, but it never works, i just get the same problem. i am now starting samba using the inetd daemon instead and it works fine, although i would rather start it as a standalone daemon. any ideas? ----- Original Message ----- From: "Joel Hammer" <Joel@HammersHome.com> To: "Richard" <rhw@shspost.co.uk>; <samba@lists.samba.org> Sent: Friday, March 21, 2003 1:34 AM Subject: Re: [Samba] Samba print command only works on restart, help!> Just guessing here: > > During startup, the path available to the shell environment is fairly > limited. This will sometimes cause file not found errors during bootup. > Maybe something weird is happening because of a path problem. > > Is the samba script being started in the right sequence? You might try > adding the startup command to run last in the boot sequence. You could > put it into /etc/rc.d/rc.local or its equivalent. > > You might just replace the current startup script with: > > killall smbd > killall nmbd > smbd -D > nmbd -D > You will need the complete path for the daemons, likely. > > Joel > > > On Thu, Mar 20, 2003 at 11:29:21AM -0000, Richard wrote: > > hey > > > > i am starting smbd using the supplied start script, but basically itjust> > calls: > > > > smbd -D > > > > every time i start the computer i get the following error messagehowever,> > even when the network cable is unplugged: > > > > [2003/03/20 11:23:47, 0] nmbd/nmbd.c:main(795) > > Netbios nameserver version 2.2.8 started. > > Copyright Andrew Tridgell and the Samba Team 1994-2002 > > [2003/03/20 11:23:51, 0] > > nmbd/nmbd_responserecordsdb.c:find_response_record(235) > > find_response_record: response packet id 8644 received with nomatching> > record. > > [2003/03/20 11:23:51, 0] > > nmbd/nmbd_responserecordsdb.c:find_response_record(235) > > find_response_record: response packet id 8645 received with nomatching> > record. > > > > does anyone know what causes this? > > > > thanks for your help. > > > > > > ----- Original Message ----- > > From: "Joel Hammer" <Joel@HammersHome.com> > > To: "Richard" <rhw@shspost.co.uk>; <samba@lists.samba.org> > > Sent: Wednesday, March 19, 2003 9:58 PM > > Subject: Re: [Samba] Samba print command only works on restart, help! > > > > > > > I guess the question is, is the same command used to start smbd atboot as> > > is used after boot? Beware those complicated startup scripts. > > > Joel > > > > > > > > > > > > > -- > > To unsubscribe from this list go to the following URL and read the > > instructions: http://lists.samba.org/mailman/listinfo/samba > > >