LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 12-12-2005, 02:02 PM   #1
thibert
LQ Newbie
 
Registered: Mar 2004
Posts: 1

Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 08:42 AM
shell question: the "mv" command with multiply files basher400 Linux - Newbie 4 12-19-2005 08:42 AM
shell scripting - using ${variable:=","} Steve Riley Linux - General 7 02-08-2005 06:07 AM
"how do I extract a number from a text file using shell command?" sdandeker Linux - Networking 3 02-12-2004 09:54 AM
Bash Script: Problem running variable command containing "" Paasan Programming 2 01-21-2004 02:45 AM


All times are GMT -5. The time now is 05:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration