root / pykota / trunk / untested / parallel / parallel.sh @ 2380

Revision 2146, 1.7 kB (checked in by jerome, 20 years ago)

It seems that $Log$ is not implemented or doesn't work for some reason

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#! /bin/sh
2
3# This script was generously contributed by Jem E. Berkes.
4# It can't work as-is with PyKota, you first have to adapt it
5# and this may require some work on your part.
6
7# It is aimed at printers which support the PJL language, which
8# are plugged through a bidirectionnal parallel port.
9
10# Read what Jem has to say about it :
11
12# It seems that network sockets or some other control specific method is the
13# best way to query the printers. What I have is a bit (well, more than just
14# a bit) of a brute forced solution. However, it has been working for us for
15# about a month and only needs a bidirectional /dev/lp0
16
17# I'm not at all happy about the sleep's I have in there. On occasion, there
18# are missing page counts in the log but since the * next * user to print
19# gets a good pagecount, the parser (a separate program) finds the
20# responsibility.
21#
22# If you find a way to improve what I have, please let me know. Note that
23# when this is invoked from printcap, it's expecting that the data coming it
24# at stdin is a pre-formatted print job (the Windows machines do that
25# anyway).
26
27# Copyright (C) 2003 Jem E. Berkes
28# jb2003@pc9.org
29# This script queries the HP LaserJet 1200 for pagecount, then prints a
30# pre-formatted job
31# Log format: DATE\tUSERNAME\tPRECOUNT
32
33PRINTDEV=/dev/lp0
34LOGFILE=$SPOOL_DIR/pagelog
35
36echo -e "\33%-12345X@PJL\n@PJL INFO VARIABLES\n\33%-12345X" > $PRINTDEV
37sleep 1
38cat $PRINTDEV > /dev/null
39echo -e "\33%-12345X@PJL\n@PJL INFO PAGECOUNT\n\33%-12345X" > $PRINTDEV
40sleep 1
41PAGECOUNT=`cat $PRINTDEV | grep "^[0-9]"`
42USERID=`echo $1 | cut -b 3- | sed "s/@.*//"`
43echo -e "`date \"+%Y-%m-%d %H:%M:%S\"`\t$USERID\t$PAGECOUNT" >> $LOGFILE
44cat > $PRINTDEV
45
Note: See TracBrowser for help on using the browser.