- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: CUPS print to unique filename
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 06:57 AM
тАО09-01-2010 06:57 AM
CUPS print to unique filename
Can the generated file have a random number as part of the filename so it doesnt keep overwriting the same file ?
I tried passing the following to the lpadmin command -v option:
file:/var/opt/rpt/fsp.$$
thinking that the $$ would be replaced with the process ID every time a new output file was generated. Unfortunately this is interpreted once when the lpadmin command is executed. I also tried backslashes and quoting.
Is what I am asking for even possible ?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-02-2010 06:35 AM
тАО09-02-2010 06:35 AM
Re: CUPS print to unique filename
I'm not sure if it works, but try it quoting with '
file:'/var/opt/rpt/fsp.$$'
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-02-2010 09:13 AM
тАО09-02-2010 09:13 AM
Re: CUPS print to unique filename
My users need a unique filename every time a request is queued.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-02-2010 09:51 AM
тАО09-02-2010 09:51 AM
Re: CUPS print to unique filename
try to feed lpadmin -v with this:
"file:$(mktemp --tmpdir=/var/opt/rpt/ -t fsp.XXX)"
this should do the job:
# echo "file:$(mktemp --tmpdir=/var/opt/rpt/ -t fsp.XXX)"
file:/var/opt/rpt/fsp.MAB
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-02-2010 11:49 PM
тАО09-02-2010 11:49 PM
Re: CUPS print to unique filename
To get what you want, you may have to write your own CUPS backend. Essentially, you name your own printer URL scheme and create a script (or any executable) in the CUPS backend directory /usr/lib/cups/backend. The backend script name should match the URL scheme name, so if your backend is /usr/lib/cups/backend/davep76, then your printer URL should begin with "davep76:".
The backend executable must fulfill certain requirements: see "man backend" for more information.
Attached is a minimal test backend script. When run without any arguments (like CUPS does when discovering backends and devices) it reports discovery information appropriate for print-to-file style functionality.
If run with arguments, it captures all the arguments to environment variables, and dumps the current environment to /tmp/testbackend.env, so that you can examine both the command line arguments and the environment variables already defined for you by CUPS. (You can remove the command that writes the /tmp/testbackend.env file once you don't need it.)
Normally a CUPS backend must be ready to receive the print job by either reading a named file, or by reading standard input if no filename is given. This test backend arranges for the data to be always available through standard input, to make it simpler to implement the actual job processing.
This test backend simply sends the print job contents to /dev/null. Replace the command "cat > /dev/null" with "cat > /var/opt/rpt/fsp.$$" and you'll have a working backend that should do what you want. CUPS and the backend script both will give you a lot of environment variables which may be useful in choosing the name of the destination file.
The backend receives the full printer URL in an environment variable. Your backend can choose to use it for something, or to ignore it completely. If you choose to ignore the device URL, only the scheme name will be important in defining the printer for CUPS: you can configure a printer with a device URL like "davep76:/meaninglessjunk" and the job will still be passed to the davep76 backend.
MK