Configure Printed Notifications
From PC2wiki
This article describes how the scoreboard module can be configured to print balloon notifications under Unix.
The Scoreboard module can print a balloon notification and other
reports. The Scoreboard module does not use lp or lpr, because those
are OS specific and one goal of PC² is to be OS independent.
A solution that the PC² Team has used for a number of years
under Unix is creating a named pipe (file). This document
will describe how to configure PC² to use that file as
well as how to create that file so it works with any
printer that can use lp.
Contents |
Scope
This article describes one way to setup printing for use by the Scoreboard module under Unix
Audience
This article assumes that the reader knows how to start a Server module and an Administrator module and has some knowledge of Unix.
Since
Balloon Notification is present in version 8.6 and later.
Steps
Steps to setup a printer for notifications under PC²
- Configure PC²
- Customize loopprint as needed
- Run/start loopprint script
Configuring under Version 8
These steps configure PC² to print notifications to the a device (/dev/balloonprinter).
- Start a server module and start a Administrator module
- On the Administrator module generate a board user account
- Add at least one Problem.
- Select: Options Tab
- Select: Balloon Options Dialog
- In the field titled Print Device(Port) enter the name of the device (ex. /dev/balloonprinter)
- Check: Postscript Capable, if printer is capable. (version 8.7 or later)
- Select: Update
Configuring under Version 9
These steps configure PC² to print notifications to the a device (/dev/balloonprinter).
- Start a server module and start a Administrator module
- On the Administrator module generate a board user account (Accounts Tab use Generate)
- Add at least one Problem.
- Select: Notifications Tab, click Add button.
- On Add Notifications Settings window
- Select a site
- Select a Balloon Client (ex. SCOREBOARD1)
- Click/Check Print Notifications
- Enter the Print Device (from the FIFO variable in
loopprint) - Optional, Fill in colors (balloon colors) right side of window
- Optional, Click/Check Send Email Notifications and fill in Contact and Server info
- click Add button
Customizing loopprint
PRINTER
The PRINTER variable by default is assigned to balloon, this should be
assigned/changed to the system printer.
FIFO
The FIFO variable by default is assigned to /dev/balloonprinter, this
typically requires that the user login as Unix root. The FIFO can be changed
to point to any writeable area, like /tmp/balloonprinter or
/home/board/balloonprinter.
Starting loopprint
loopprint is used to both create a fifo device and to send data to the printer using the lp Unix command.
To run loopprint enter the following
sh loopprint
loopprint
For reference, a copy of a version of loopprint is included here. The loopprint script is also in the samps directory on the PC² distribution.
#!/bin/sh # File: loopprint # Purpose: to create a local file connected to a remote printer # for use by the board # Author: pc2@ecs.csus.edu # Revised: Sun May 1 18:17:17 PDT 2005 # # $Id: loopprint,v 1.1 2005/05/02 01:17:53 boudreat Exp $ # CUSTOMIZE HERE # this is the local print queue # test with: lp -d thisvalue file_to_print PRINTER=balloon # use this value in the balloon "Print Device(Port)" # may need to change this to a user writable directory FIFO=/dev/balloonprinter # the rest should not change if [ -e $FIFO ]; then if [ ! -p $FIFO ]; then echo $FIFO is not a pipe, cannot continue exit 2 fi else # make the pipe mkfifo $FIFO # attempt to clean up after ourselves trap 'rm -f $FIFO;exit 0' 0 fi while /bin/true do cat $FIFO | lp -d $PRINTER done # eof
