Hi all,We have an Hp8100 printer shared by 2 queues, setting the accounting script option in ifhp, (my script is in attachment as an example) I save the accounting info in a mysql DB (through pipes for efficiency).
Our organisation plans to roll out duplex printing to users using existing
printers (HP8100). I have set up another set of print queues for duplex
printing so that we can better keep the statistics and work out some
schemes to encourage users to use duplex printing, i.e., one physical
printer shared by two print queues (one for simplex printing, one for
duplex printing).
On testing the environment, we encountered a print accounting problem. Our print accounting scripts utilize ifhp to get the page counter from the
printer and work well most of the time. On encountering problem with
getting the print job pagecount, our script will save a copy of current
print status (username and counter) to a file and will bill back the user
on next print job. This works pretty well with a printer and a simplex
queue as the page counter should not be altered until the next print job
is printing. For two print queues sharing a printer, this would cause
problem as the print counter will keep on changing with print jobs on
counterpart queue (simple/duplex).
Is there anyone implemented similar configuration without problem (2
queues sharing a printer accounting problem) or is there elegant way to
tell whether a print job is duplex if using a single print queue for both simplex and duplex?
Thanks for your help. KC Chang
All things are right, no problems at all, and the system is running since '00.
Then with the accounting info saved in the DB, I can do any thing I can think...
Bye. -- Dott. Sergio Rabellino
Technical Staff Department of Computer Science University of Torino (Italy)
http://www.di.unito.it/~rabser Tel. +39-0116706701 Fax. +39-011751603
#!/bin/sh PATH=/bin:/usr/bin:/usr/local/bin export PATH LD_LIBRARY_PATH=/opt/mysql/lib/mysql export LD_LIBRARY_PATH
pages=
pid=
controlfile=
login=
host=
printer=
pagecounter=
format=
elapsed=
time=
accountingfile=
remoteaccount=
# Check for file
if [ ! -f "/opt/LPRng/tmp/account.log" ]; then
echo > /opt/LPRng/tmp/account.log
fi
if [ ! -f "/opt/LPRng/tmp/debug.log" ]; then
echo > /opt/LPRng/tmp/debug.log
fi
command=$1
if [ "x$command" = "xstart" ]; then
echo "COMMAND IS: $command" >> /opt/LPRng/tmp/debug.log
fi
echo $0 $* 1>&2 >> /opt/LPRng/tmp/debug.log
while [ $# != 0 ];
do case "$1" in
-b* ) pages=`echo "$1" | sed s/..//` ;;
-q* ) pid=`echo "$1" | sed s/..//` ;;
-k* ) controlfile=`echo "$1" | sed s/..//` ;;
-n* ) login=`echo "$1" | sed s/..//` ;;
-h* ) host=`echo "$1" | sed s/..//` ;;
-P* ) printer=`echo "$1" | sed s/..//` ;;
-p* ) pagecounter=`echo "$1" | sed s/..//` ;;
-F* ) format=`echo "$1" | sed s/..//` ;;
-Z* ) zoption=`echo "$1" | sed s/..//'`;;
-T* ) time=`echo "$1" | sed 's/..//'` ;;
-R* ) remoteaccount=`echo "$1" | sed 's/..//'` ;;
-* ) ;;
* ) accountingfile=$1;;
esac;
shift;
done
if [ "x$pages" != "x" ] ; then
/bin/echo "INSERT INTO stampe (user,pages,printername) VALUES ( \"$login\", $pages,
\"$printer\" );" | /opt/LPRng/scripts/tolower >> /opt/LPRng/tmp/account.log
#SAVE accounting info in the DB
/opt/LPRng/scripts/accounting_mysql $login $pages $printer >>
/opt/LPRng/tmp/debug.log
if [ "x$remoteaccount" != "x" ]; then
/bin/echo "Job Printed on $printer: $pages pages" |
/opt/LPRng/scripts/notifyWin32.pl $remoteaccount >> /opt/LPRng/tmp/debug.log
else
/bin/echo "Job Printed on $printer: $pages pages" |
/opt/LPRng/scripts/notifyWin32.pl $host >> /opt/LPRng/tmp/debug.log
fi
else
if [ "x$time" != "x" ]; then
# This is a fileend call, with no pages printed !
/bin/echo "Printing ERROR from job ( \"$login\", \"$printer\" )" >>
/opt/LPRng/tmp/debug.log
#SAmba message
/opt/LPRng/scripts/advertise $login $pages $printer >> /opt/LPRng/tmp/debug.log
if [ "x$remoteaccount" != "x" ]; then
/bin/echo "Job Failed on $printer, contact Technicians a.s.a.p." |
/opt/LPRng/scripts/notifyWin32.pl $remoteaccount >> /opt/LPRng/tmp/debug.log
else
/bin/echo "Job Failed on $printer, contact Technicians a.s.a.p." |
/opt/LPRng/scripts/notifyWin32.pl $host >> /opt/LPRng/tmp/debug.log
fi
fi
fi
exit 0
