ITEM: H3543L
Can I print a document with current time a date as header?
Question:
AIX 3.2.5
model 520
Can I print a document with current time a date as header?
Response:
Customer doesn't want to have a seperate header page. She would like
to have the time and date printed at the top of the first page of
the document.
There are at least two ways to do this. You may choose to write a script which
will write the date to a file, then enq the file to a printer. The other choice is
to make another local queue with a custom backend which will do the same as the script.
I had the customer create a new local queue in smit.
smitty printer
Manage Local Printer Subsystem
Local Printer Queues
Add a Local Queue
Make your setup screen look something like this.
Add a Local Queue
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
* NAME of queue to add [dateq]
ACTIVATE the queue? yes +
Will this become the DEFAULT queue? no +
Queuing DISCIPLINE first come first serve +
ACCOUNTING FILE pathname []
* NAME of device to add [ddateq]
BACKEND OUTPUT FILE pathname [FALSE]
ACCESS MODE of backend output file write only +
* BACKEND PROGRAM pathname [/bin/sh /bin/cusbkend]
Number of FORM FEEDS prior to printing [0] \#
Print HEADER pages? never +
Print TRAILER pages? never +
ALIGN pages between files within jobs? yes +
Then vi the file cusbkend and insert the following
date > /tmp/testfile
echo '\\n' >> /tmp/testfile
cat $1 >> /tmp/testfile
sleep 2
enq -c -P \ /tmp/testfile
/*where \ is the name of the local queue that already prints to the
printer*/
After you save this file run the following commands
chmod +x cusbkend
chown root:printq cusbkend
Now you should be able to enq a file to the queue dateq which will print out
the file with the time and date at the top of the file. This method allows you
use the enq of lp commands to print these files, however you will not be able
to send flags with this enq command because of the new backend.
The other method of doing this would be to write a shell script.
First vi the file /bin/dateq
insert the following
date > /tmp/dateqfile
cat $2 >> /tmp/dateqfile
sleep 2
enq -P $1 /tmp/dateqfile
Then run the following
chmod +x dateq
Then to run the script, type
dateq \ \
This method allows you to print to any queue and is probably preferable to
use instead of the above method, unless you do not want to change the method
in which you issue print commands.
The new queue that the customer made worked fine. She has several printers
which she would like to print to so I will mention the script to her later.
Response:
I had the customer try the script and it worked fine also. She prefered this
because she could print to any queue. Item closed.
Support Line: Can I print a document with current time a date as header? ITEM: H3543L
Dated: March 1994 Category: N/A
This HTML file was generated 99/06/24~13:30:47
Comments or suggestions?
Contact us