[cups.general] file:/ Permissions
Johannes Meixner
jsmeix at suse.de
Wed Feb 13 23:28:36 PST 2008
Hello,
On Feb 13 20:31 Shyper wrote (shortened):
> ... create a custom backend ...
Here a very simple example for a selfmade "mylp0" backend
for the parallel port with everything hardcoded in the backend
and a possible (but unlikely) race condition:
----------------------------------------------------------------------
#! /bin/bash
# See the man page "man backend".
# debug info in /var/log/cups/error_log
set -x
# output "Device Discovery" information on stdout
if test "$#" = "0"
then
echo 'direct mylp0:/dev/lp0 "Unknown" "lp0 device"'
exit 0
fi
# have the input at fd0 (stdin) in any case
if test -n "$6"
then
exec <"$6"
fi
# infinite retries to access the device
until cat /dev/null >/dev/lp0
do
echo 'INFO: cannot access /dev/lp0 - waiting 30 seconds' 1>&2
sleep 30
done
echo 'INFO: sending the data to /dev/lp0' 1>&2
# forward the data from stdin to the device
if cat - >/dev/lp0
then
echo 'INFO:' 1>&2
exit 0
else
echo 'ERROR: failed to send the data to /dev/lp0' 1>&2
exit 1
fi
----------------------------------------------------------------------
Place it with file name "mylp0" (i.e. what the device discovery
information shows as URI scheme - see "man backend") in the
directory of the other backends (e.g. /usr/lib/cups/backend/)
with same owner, group and permissions as the other backends
(but a bash script needs read and exectute permissions).
Restart cupsd and verify with "lpinfo -v" that the cupsd has
recognized the new backend "mylp0".
Kind Regards
Johannes Meixner
--
SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
AG Nuernberg, HRB 16746, GF: Markus Rex
More information about the cups
mailing list