General discussion

Locked

Allow user view/ print report in Unix

By mreid ·
Currently we are running batch jobs that automatically report results to various printers in office. We would like to instead have output go to file and allow some a user ( easy understand, simple app) to receive msg, pull up file to review results, and then print it if necessary. This would help reduce waste of paper. Is there any app currently out there or an easy tech solution to solve this issue?

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Allow user view/ print report in Unix

by Stillatit In reply to Allow user view/ print ...

If the unix app prints to standard output (most do), redirect the output to a file, then mail to the file to whichever users need it, or mail them a notice.

Look at how the command is written now. If you see something like:
myapp | lp
That isrouting the output of myapp to the lp (line print) program. (lpr is another line print program). Replace the pipe to line print with a redirect symbol ">" and the path and file name where the output is to go.

In a batch file, do something like this:

#
# the following line runs myapp and shoves the output in a file: /tmp/myoutfile
/usr/local/bin/myapp >/tmp/myoutfile
#
# the folowing line mails the output
/usr/bin/mail -s "Myapp output" groupname </tmp/myoutfile
#
# the following lines just mail a notice
/usr/bin/echo "Myapp output may be found in /tmp/myoutfile" /tmp/myout1
/usr/bin/mail -s "Myapp output is ready" groupname < /tmp/myout1
/usr/bin/rm /tmp/myout1
# if you do not provide the input to mail,
# it will do a console prompt --
# not good in a batch file

groupname can be a user or an alias for a list of users on the unix box.

You can add a line to delete the file after the send, but the next time the batch is run the file will be overwritten.

A unix user can look at the file with more, or with an editor such as vi, and can print the file with the lp command.

Good luck.

Collapse -

Allow user view/ print report in Unix

by Stillatit In reply to Allow user view/ print ...

Murphy strikes again! The line reading:
usr/bin/echo "Myapp output may be found in /tmp/myoutfile" /tmp/myout1
should read:
usr/bin/echo "Myapp output may be found in /tmp/myoutfile" > /tmp/myout1

Collapse -

Allow user view/ print report in Unix

by mreid In reply to Allow user view/ print ...

Poster rated this answer

Collapse -

Allow user view/ print report in Unix

by mreid In reply to Allow user view/ print ...

This question was closed by the author

Back to Software Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums