LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Shell Variable available within Samba "print command" (https://www.linuxquestions.org/questions/linux-networking-3/shell-variable-available-within-samba-print-command-391990/)

thibert 12-12-2005 01:02 PM

Shell Variable available within Samba "print command"
 
I am using the "printpdf" shell below and it is working well. Except I would like a better naming convention for outpout PDF files.

Is there a Shell variable within the SAMBA PRINT COMMAND environment I can use to identify the PRINT REQUESTER PC NAME or TCPIP address, anything unique to the requester ID. My final result of printpdf wouldbe:

"Joe date H M S.pdf"
or "10.1.1.120 date H M S.pdf"

instead of "date H M S.pdf"

I am currently using "FileName" variable in the shell...

Thanks, RT

/////////////// my Samba setup ////////////
//// statement in smb.conf //////
[PDFDocs]
comment = SambaOne PDF Printer Documents
path = /mnt/pdfdocs
writeable = yes
guest ok = yes
; Set up our PDF-creation print service
[pdf]
path = /tmp
printable = yes
guest ok = yes
print command = /usr/bin/printpdf %s
lpq command =
lprm command =

//////////// PRINTPDF SHELL COMMAND called by SAMBA PRINT COMMAND
#!/bin/sh
# ////// printpdf shell program /////
# script to convert a specified postscript file into a PDF
# and place it in a location that is shared by the Samba server.
# Arguments:
# 1st - The name of the spool file
# John Bright, 2001, jbright winfordeng com
# create the pdf into a temporary file based on current date and time.
# After we are finished, rename it same date, but ending
# in .pdf. We do this because if a user tries to open a PDF that is
# still being written, they will get a message that it is corrupt,
# when it is actually just not done yet.

FileName =`date +%b%d-%H%M%S`

OUTDIR=/mnt/pdfdocs

ps2pdf $1 $OUTDIR/$FileName.temp

mv $OUTDIR/$FileName.temp $OUTDIR/$FileName.pdf

rm $1


All times are GMT -5. The time now is 03:01 AM.