[Samba] ps2pdf "Print command" script trouble

Ladner, Eric (Eric.Ladner) Eric.Ladner at ChevronTexaco.com
Tue Aug 13 09:19:00 GMT 2002


Also, check that $psin exists, and that $targetdir is writable by
the user executing the script:

    # put these before your system call.
    # They may have to be logged to another file so you can see the 
    # output.
    print "$psin does not exist." unless ( -f $psin );
    print "$targetdir is not writable." unless ( -w $targetdir );

Eric

-----Original Message-----
From: Dennis [mailto:dennis.moreno at pop.safetran.com]
Sent: Monday, August 12, 2002 11:34 AM
To: samba at lists.samba.org
Subject: [Samba] ps2pdf "Print command" script trouble


hi

2.2.5, Sol 2.8
I have a perl script that I've written to convert a ps file to pdf file.
I want the user to be able to setup a postscript printer in WNT/2k and
convert ps files to pdf by printing to a [ps2pdf] printer share.

[ps2pdf]
     comment = PS to PDF file in Home Directory
     path = /usr/spool/public
     guest ok = Yes
     print ok = Yes
     browseable = Yes
     printer = ps2pdf     <--There is no real unix printer named this.
     print command = /usr/local/samba.22/ssc/ps2pdf.pl %s %H
#   printer driver = Apple LaserWriter v23.0
     oplocks = No
     share modes = No


My problem:

When I run the script manually it works fine. But when I print to the
share, nothing happens. I change the print command to print out the
values of the % variables so I could see the variable substitutions were
occuring correctly and they were.

Here is my perl script:

Begin-----------------------------------------------------------------
#!/usr/local/bin/perl -w
#
# ps2pdf.pl Description:
# A perl script that converts postscript files to pdf files
# It creates the pdf file in the directory specified.
# It needs the following arguments:
#       ARG1    $filename       %s
#       ARG2    $targetdir      %H
#========================================================

use strict;

if ($#ARGV == 1) {
         my ($filename,$targetdir) = @ARGV;
         my      $psin = "/usr/spool/public/" . $filename;
         my      $pdfout = $targetdir . "/" . $filename . ".pdf";
         my      $rc = 0xffff & system("/usr/local/bin/ps2pdf $psin
$pdfout");
         my $message;
         if ($rc == 0) {
                 $message = "Succeeded.";
         } else {
                 $message = "Failed.";
         }
         print "Conversion: $message\n";
         system("if [ -f $psin ]; then /usr/bin/rm $psin; fi");
} else {
         print "Usage: ps2pdf.pl [filename] [target directory]\n";
}

exit 0;
End-------------------------------------------------------------

Can someone tell me what I'm doing wrong??
Dennis


+******+ 

This e-mail message is meant solely for the person or organisation to whom
it is adressed. The message may contain personal or confidential
information, or information that is not public in nature. Safetran Systems
Corporation accepts no responsibility for message content and possible
attachments that are unlawful or of questionable decency. Further
dissemination, publication or duplication of this message is strictly
prohibited if the person or organisation receiving this message is not the
intended recipient. In the event that you are not the intended recipient, we
request you to refrain from using the content and to immediately inform the
the sender of the error by returning the message. Thank you for your
co-operation. 
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  http://lists.samba.org/mailman/listinfo/samba




More information about the samba mailing list