Can I remove the file after sending it to CUPS? - printing

If I send a ps- or pdf-file to CUPS is it then stored in the queue as is or is it only a pointer to the file that is in the queue?
In other words: Could the file be removed from disk after it has been sent (and placed in the printer queue) but before it is actually printed?
If there is some load on the printer would this test produce any paper:
#!/bin/bash
uptime | mpage > uptime.ps
lpr uptime.ps
rm uptime.ps

I had the same question for myself and just tested it.
lpr -P myprinter myfile.pdf && rm myfile.pdf
did print the 700K PDF file even though it was removed immediately after sending to print.
So I'd say the answer is "yes".

Related

Print diffrent type files with lpr at once

I want to print different files using lpr command to a thermal printer. They need to be printed at once because they're from the same receipt. If I use the following commands
lpr -P POS58 aux.txt
lpr -P POS58 qr.bin
They are printed fine but there's too much time in between the first and second printing. But if I do it like this
lpr -P POS58 aux.txt qr.bin
Only the first file is printed, it doesn't happen with same extension files but it happens here. How could I print all at once?

GNU Parallel output to stdout using --round-robin

I'm trying to use GNU Parallel to help me process some remote files that I don't want to save locally.
My command looks somewhat like that:
python list_files.py | \
parallel -j5 'aws s3 cp s3://s3-bucket/{} -' | \
parallel -j5 --round --pipe -l 5000 "python process_and_print.py"
process_and_print.py prints output for some input lines, but that output doesn't get to stdout immediately like I expected, instead I only see the output after the process is finished. If I remove the --round parameter is all works as expected.
Where does all that data get saved? Do I have a way to print it to stdout, line by line, without buffering?
Where does all that data get saved?
All buffered output from GNU Parallel is buffered in temporary files in $TMPDIR / --tmpdir which defaults to /tmp. You cannot see the files, as they are immediately removed (but kept open) to avoid you having to clean up, if GNU Parallel is killed.
Do I have a way to print it to stdout, line by line,
--line-buffer
without buffering?
-u disables buffering all together, but then you cannot guarantee line-by-line.
--line-buffer buffers a full line in memory from version 20170822 and thus does not buffer in /tmp.

Used `tar -xz` without `f` and now program stuck

Strangely, I had assumed the -f option was for "force", not for "file".
I ran tar -xz because I wanted to see if any files would be overwritten. Now it has extracted all the files but has not returned control back to me. Should I just kill the process? Is it waiting for input?
-f commands tar to read the archive from a file. Without it, it tries to read it from stdin.
You can input Ctrl-C to kill it or Ctrl-D (Ctrl-Z in Windows) to send it EOF (at which point, it'll probably complain about incorrect archive format).
Without an -f option, tar will attempt to read from the TAPE device specified by the TAPE environment variable, or a file built into tar (usually something like /dev/st0 or stdin) if TAPE isn't set to anything.

BlueZ map-client and iOS 8.x device

I am attempting to use the supplied map-client in BlueZ 5.30 to read the SMS inbox from an iPhone running iOS 8.3
When I run the map-client with the phone's address I can use calls such as -l to see the directory listings and through repeated -c calls I've worked out that the messages should be in /telecom/msg/inbox.
However, I can never see any messages in this folder when called -L despite there being lots in the phones Message app. I've also tried sending a message to the phone and asking for the folder, but nothing appears - I always get an empty python list:
{}
Has anyone else managed to use BlueZ map-client to read an iOS device's messages?
To view messages in the inbox, first we have to change the directory to the standard path /telecom/msg/inbox.
so ./map-client -d BD_ADDRS -c /telecom/msg/inbox -L LS_MSG
similarly for outbox, sent, draft, deleted
I just ran into the same problem and wound up here so I'll post for the benefit of anyone else who does the same:
The LS_MSG argument to -L is treated as the folder to read, so to read the inbox the command would be:
./map-client -d BD_ADDRS -c /telecom/msg -L inbox
This wasn't at all clear to me from the ./map-client --help output, so I ended up reading the source code to figure it out.

make an lp script into functioning printer

I'm trying to print to separate printers simultaneously in Ubuntu 14.04
From all of my reading the best option I've seen is to write a script
that sends an lp command to the separate printers.
This is the script I've written so far
!/bin/bash
lp -d printer "$#"
lp -d printer2 "$#"
where printer and printer 2 are the actual printers installed on the system
This script works from a terminal, however I would like to be able to send print jobs directly to a "printer" that is actually the script I've written.
How can I make this lp script into a "printer"
Ok I didn't find a way to do this the way I originally intended, however it is possible with tea4CUPS
great cups backend tool with an easy config file
http://www.pykota.com/software/tea4cups/download
The install instructions are on the download page.
As for printing to multiple printers, add this command in the config file for every printer you wish to print to.
prehook_firstprinter: /usr/bin/lp -d Name of Printer -o raw $TEADATAFILE
Here are the simplest instructions I could write
1. download the tea4cups.gz
Extract it to the home folder, rename it to tea4cups
Open a terminal and run these commands
sudo cp /home/manifester/tea4cups/tea4cups.conf /etc/cups
sudo cp /home/manifester/tea4cups/tea4cups /usr/lib/cups/backend/
sudo chmod 700 /usr/lib/cups/backend/tea4cups
Run this command
sudo gedit /etc/cups/tea4cups.conf
Paste this in the bottom of the document
prehook_firstprinter: /usr/bin/lp -d Name of Printer yes the literal name in the printer window -o raw $TEADATAFILE
you will need a new line for every printer you have, so if you want to print to 3 printers you will need three of the above line each having the name of the printer it will be talking to.
save and close everything
open a terminal and run
sudo service cups restart
open a web browser and go to the browser cups controller
http://localhost:631/admin
go to Add Printer
you should see a printer named "tea4CUPSnothing"
If you don't see it go back and press "Find Printers"
it should be there
Change the info of the printer to "Print all" for all type fields"
Press Continue
The generic printer driver works because the printer doesn't actually exist.
Press Continue
Set Defaults
you should be done, go to your printer window on ubuntu and do a test print.

Resources