Custom Backend not recognized
Custom Backend not recognized
I am trying to create a custom backend.
I followed instructions to create a backend "for debbuging" : a "tofile" backend.
I registered it in /usr/lib/cups/backend and restarted the service.
But when I try :
lpinfo -v
It doesn't show, and in my error_logs I Have :
[cups-deviced] PID 8330 (tofile) stopped with status 8!
Here aree the permission :
-rwxr-xr-x 1 root root 715 juil. 1 10:38 tofile
I found a topic about the problem, I have not this error for the same reason (No trailing whitespace in script, ...).
When I use :
sudo file /usr/lib/cups/backend/tofile
/usr/lib/cups/backend/tofile: ASCII text
I also heard about the cupsd.conf using file-device, but it is marked as deprecated in the documentation...
Obviously, the script is the same as in the tutorial :
#! /bin/bash
# Have debug info in /var/log/cups/error_log:
set -x
# Output "device discovery" information on stdout:
if test "$#" = "0"
then echo 'direct tofile:/tmp/tofile.out "Unknown" "/tmp/tofile.out"'
exit 0
fi
# Have the input at fd0 (stdin) in any case:
test -n "$6" && exec <"$6"
# Infinite retries to access the file:
until cat /dev/null >/tmp/tofile.out
do echo 'INFO: cannot access /tmp/tofile.out - retry in 30 seconds' 1>&2
sleep 30
done
echo 'INFO: sending data to /tmp/tofile.out' 1>&2
# Forward the data from stdin to the file:
if cat - >/tmp/tofile.out
then echo 'INFO:' 1>&2
exit 0
else echo 'ERROR: failed to send data to /tmp/tofile.out' 1>&2
exit 1
fi
(but without the trailing space at the first line ^^ !)
#!/bin/bash
set -x
Did it. Even trying to re-type the shebang, it still remains non executable...! The set -x refers to error_log in cups logs but I have nothing more than the line I posted...
– Aeldred
Jul 1 at 12:07
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Something seems off, if 'file' gave you 'ASCII text' and not 'ASCII text executable'. Try deleting the shebang line (#!) entirely and re-typing it like this
#!/bin/bash. Also, you haveset -x, see if you got any output in the error log to find out where and why it exited (post the output here in your question).– Leo K
Jul 1 at 11:33