Backend Problem / Understanding issue
Rüdiger Müller
mueller.os at web.de
Sun Jul 29 12:49:54 PDT 2007
I've written it in cups.general, but try it here again.
So, please feel free to give hints, that enable me to understand my problem.
Hello,
if Cups starts the Backend it holds this Process and does not execute it.
Output from ps -xa:
3648 ? R 0:00 /bin/bash /usr/lib/cups/backend/an_drucken_aus.sh 78 guest Test Page 1 job-uuid=urn:uuid:55db99d8-092f-3c72-54d3-48cd8a54f730
I do not know why this happens. The script contains a root-statement (switch a electr. socket of an USB-Device on, then wait till no job is in /var/spool/cups, and then switch socket off.), but my user cupsys is in the root-group.
So my problem is that the script is executable from command-line with user cupsys, but does not execute when called from within cups.
What a command does CUPS execute when a print job arrive? Is it (for development purposes) possible to execute such a command from the commandline. Perhaps a test-site?
Anyway here the script, if someone is interested.
Version 0.001
---
Script for switching a (Printer)-Socket on before printing, and switching it off when all jobs in /var/spool/cups deleted.
#!/bin/bash
#Diagnose
#If Cups start the script there is no output in the ./whoami file
whoami >> ./whoami
#Parameter
typeset -r jobhdatei="c000"$1
#Constants
typeset -r spooldir="/var/spool/cups"
#Zeit
typeset -i -r nachlaufzeit=5
typeset -i -r zeiteinheit=1
function An()
{
/usr/bin/sispmctl -o 1
typeset -i paus=0
typeset -i weiter=1
while [ $weiter -eq 1 ] ;
do
if [ -e /dev/usb/lp0 ] ;
then
echo "An"
weiter=0
else
sleep $paus
weiter=1
fi
done
return
}
function Aus()
{
/usr/bin/sispmctl -f 1
echo "Aus"
return
}
function Drucken()
{
echo "Drucken"
function JobFertig()
{
if [ -e $spooldir/$jobhdatei ] ;
then
return 0
else
#Datei gel., fertig
return 1
fi
}
typeset -i zeit=$nachlaufzeit
function ZeitAbgelaufen()
{
if [ $zeit -le 0 ] ;
then
return 1
else
return 0
fi
}
function ZeitLaeuft()
{
sleep $zeiteinheit
zeit=`expr $zeit - $zeiteinheit`
return
}
typeset -i paus=0
typeset -i fertig=0
while [ $fertig -eq 0 ] ;
do
JobFertig
fertig=$?
sleep $paus
echo "Sleeping"
done
typeset -i abgelaufen=0
while [ $abgelaufen -eq 0 ] ;
do
ZeitLaeuft
ZeitAbgelaufen
abgelaufen=$?
echo "Nachlauf"
done
function WeitereJobs()
{
typeset -i anzahl=`ls -l $spooldir | wc -l`
anzahl=`expr $anzahl - 2`
return $anzahl
}
WeitereJobs
typeset -i weitere=$?
if [ $weitere -eq 0 ] ;
then
Aus
return 1
else
return 0
fi
}
if [ $# = 0 ]
then
echo "SIS-PM \"SIS-PM Powered Printer\" \"SIS-PM Printer Port\""
exit 0
fi
An
Drucken >> druck_log&
#Usage: usb job-id user title copies options [file]
export DEVICE_URI="usb://Brother/MFC-8420"
exec -a ${DEVICE_URI} /usr/lib/cups/backend/usb "$@"
More information about the cups
mailing list