Hi Ferrari,
thanks for your reply. Here the answer of the commands:
hp-testpage
HP Linux Imaging and Printing System (ver. 3.16.11)
Testpage Print Utility ver. 6.0
Copyright (c) 2001-15 HP Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.
error: No device found that support this feature.
error: No installed printers found (or) Invalid printer device selected
hp-check -t
error: avahi-utils avahi-utils OPTIONAL - - MISSING 'avahi-utils needs to be installed'
scanimage scanimage - Shell scanning program OPTIONAL 1.0 1.0.25 OK -
error: dbus DBus - Message bus system REQUIRED - 1.10.26 MISSING 'DBUS may not be installed or not running'
gs GhostScript - PostScript and PDF language interpreter and previewer REQUIRED 7.05 9.20 OK -
error: xsane xsane - Graphical scanner frontend for SANE OPTIONAL 0.9 - MISSING 'xsane needs to be installed'
network network -wget OPTIONAL - 1.18 OK -
error: cups CUPS - Common Unix Printing System REQUIRED 1.1 - INCOMPAT 'CUPS may not be installed or not running'
policykit PolicyKit - Administrative policy framework OPTIONAL - 0.105 OK -
----------------------
| Scan Configuration |
----------------------
scanext Scan-SANE-Extension REQUIRED - 3.16.11 OK -'/etc/sane.d/dll.d/hpaio' not found.
hpaio HPLIP-SANE-Backend REQUIRED - 3.16.11 OK 'hpaio found in /etc/sane.d/dll.conf'
---------------------
| Python Extentions |
---------------------
cupsext CUPS-Extension REQUIRED - 3.16.11 OK -
hpmudext IO-Extension REQUIRED - 3.16.11 OK -
------------------------
| General Dependencies |
------------------------
error: libusb libusb - USB library REQUIRED - 1.0 MISSING 'libusb needs to be installed'
python3X Python 2.2 or greater - Python programming language REQUIRED 2.2 3.5.3 OK -
error: python3-pyqt4-dbus PyQt 4 DBus - DBus Support for PyQt4 OPTIONAL 4.0 - MISSING 'python3-pyqt4-dbus needs to be installed'
error: python3-devel Python devel - Python development files REQUIRED 2.2 3.5.3 MISSING 'python3-devel needs to be installed'
error: libjpeg libjpeg - JPEG library REQUIRED - - MISSING 'libjpeg needs to be installed'
error: sane-devel SANE - Scanning library development files REQUIRED - - MISSING 'sane-devel needs to be installed'
error: cups-devel CUPS devel- Common Unix Printing System development files REQUIRED - - MISSING 'cups-devel needs to be installed'
python3-reportlab Reportlab - PDF library for Python OPTIONAL 2.0 3.3.0 OK -
error: cups-image CUPS image - CUPS image development files REQUIRED - - MISSING 'cups-image needs to be installed'
sane SANE - Scanning library REQUIRED - - OK -
error: libcrypto libcrypto - OpenSSL cryptographic library REQUIRED - 1.1.0 MISSING 'libcrypto needs to be installed'
error: libnetsnmp-devel libnetsnmp-devel - SNMP networking library development files REQUIRED 5.0.9 - MISSING 'libnetsnmp-devel needs to be installed'
error: python3-pyqt4 PyQt 4- Qt interface for Python (for Qt version 4.x) REQUIRED 4.0 - MISSING 'python3-pyqt4 needs to be installed'
python3-dbus Python DBus - Python bindings for DBus REQUIRED 0.80.0 1.2.4 OK -
libpthread libpthread - POSIX threads library REQUIRED - b'2.24' OK -
python3-xml Python XML libraries REQUIRED - 2.2.0 OK -
python3-pil PIL - Python Imaging Library (required for commandline scanning with hp-scan) OPTIONAL - 1.1.7 OK -
error: python3-notify2 Python libnotify - Python bindings for the libnotify Desktop notifications OPTIONAL - - MISSING 'python3-notify2 needs to be installed'
--------------
| COMPILEDEP |
--------------
make make - GNU make utility to maintain groups of programs REQUIRED 3.0 4.1 OK -
gcc gcc - GNU Project C and C++ Compiler REQUIRED - 6.3.0 OK -
error: libtool libtool - Library building support services REQUIRED - - MISSING 'libtool needs to be installed'
------------------------------
| DISCOVERED SCANNER DEVICES |
------------------------------
No Scanner found.
--------------------------
| DISCOVERED USB DEVICES |
--------------------------
No devices found.
---------------------------------
| INSTALLED CUPS PRINTER QUEUES |
---------------------------------
HP_Color_LaserJet_CM2320nf_MFP
------------------------------
Type: Unknown
Device URI: socket://192.168.6.35
PPD: /etc/cups/ppd/HP_Color_LaserJet_CM2320nf_MFP.ppd
warning: Failed to read /etc/cups/ppd/HP_Color_LaserJet_CM2320nf_MFP.ppd ppd file
PPD Description:
Printer status: printer HP_Color_LaserJet_CM2320nf_MFP is idle. enabled since Wed 25 Jul 2018 15:05:40 UTC
warning: Printer is not HPLIP installed. Printers must use the hp: or hpfax: CUPS backend for HP-Devices.
HP_HP_Color_LaserJet_CM2320nf_MFP
---------------------------------
Type: Unknown
Device URI: dnssd://HP%20Color%20LaserJet%20CM2320nf%20MFP%20(03AC46)._pdl-datastream._tcp.local/
PPD: /etc/cups/ppd/HP_HP_Color_LaserJet_CM2320nf_MFP.ppd
warning: Failed to read /etc/cups/ppd/HP_HP_Color_LaserJet_CM2320nf_MFP.ppd ppd file
PPD Description:
Printer status: printer HP_HP_Color_LaserJet_CM2320nf_MFP is idle. enabled since Fri 20 Jul 2018 13:01:45 UTC
warning: Printer is not HPLIP installed. Printers must use the hp: or hpfax: CUPS backend for HP-Devices.
--------------
| PERMISSION |
--------------
-----------
| SUMMARY |
-----------
Missing Required Dependencies
-----------------------------
error: 'libdbus-1-dev' package is missing/incompatible
error: 'cups' package is missing or 'cups' service is not running.
error: 'libcups2' package is missing/incompatible
error: 'libusb-1.0.0-dev' package is missing/incompatible
error: 'python3-dev' package is missing/incompatible
error: 'libjpeg62-turbo-dev' package is missing/incompatible
error: 'libsane-dev' package is missing/incompatible
error: 'libcups2-dev' package is missing/incompatible
error: 'cups-bsd' package is missing/incompatible
error: 'cups-client' package is missing/incompatible
error: 'libcupsimage2' package is missing/incompatible
error: 'libcupsimage2-dev' package is missing/incompatible
error: 'libssl-dev' package is missing/incompatible
error: 'libsnmp-dev' package is missing/incompatible
error: 'snmp' package is missing/incompatible
error: 'python3-pyqt4' package is missing/incompatible
error: 'gtk2-engines-pixbuf' package is missing/incompatible
error: 'libtool' package is missing/incompatible
error: 'libtool-bin' package is missing/incompatible
Missing Optional Dependencies
-----------------------------
error: 'avahi-utils' package is missing/incompatible
error: 'xsane' package is missing/incompatible
error: 'python3-dbus.mainloop.qt' package is missing/incompatible
error: 'python3-notify2' package is missing/incompatible
Total Errors: 16
Total Warnings: 2
Here my code:
Code:
#!/bin/bash
# versione V1.0 first version 08.12.2016
# versione V1.1 14.12.2016: check if printer is online. Send Email if printer is offline
# versione V1.2 27.12.2016: added watchdog feature. Script write on a file chacked by a watchdog. If fie is not overwritten every 5 min system will be resetted
# versione V1.3 23.8.2018: some PDF will not be printed: upgraded to debian 9 (before 8) now all PDF are not seen as corrupted
# Problems with version 9. Not all file are printed if sended together. Need a timeout between every page. Still problem on printing
SUPPORTED_FILETYPES=".pdf.jpg.png.tif.gif"
LP_OPTIONS="-o media=A4,tray1 -o fit-to-page -o position=top -o scaling=100"
MAIL_ADDRESS1="myorders@mydomain.ch"
MAIL_ADDRESS="info@mydomain.ch"
MAILFILE=~/mailtemp/$(date +%F%H%M%S).eml
WD_FILE=~/watchdog_file.txt
TEMP_FOLDER=~/temp
PRINT_FOLDER=~/printable
# write to a file to reset watchdog
cat <<EOF > $WD_FILE
reset_wd
EOF
/usr/bin/fetchmail --bsmtp $MAILFILE -s --fetchlimit 1
if [[ $? = "0" || $? = "13" ]]; then
# EXIT CODE of fetchmail is 0 if only one msg and 13 if there is more msgs
# /usr/bin/uudeview +e $SUPPORTED_FILETYPES -p $PRINT_FOLDER -i $MAILFILE
ripmime -i $MAILFILE -v -d $PRINT_FOLDER
PRINTED="no"
HTML_FILE="no"
#delete all file that are not necessary
cd $PRINT_FOLDER
for f in textfile*
do
if grep -q "This is a multi-part message in MIME format" "$f"; then
rm "$f"
continue
fi
if [[ $(file --mime-type -b "$f") == text/html ]]; then
html2ps "$f" > "000_intestazione$f.ps" 2>/dev/null
rm "$f"
HTML_FILE="yes"
fi
done
# join all txt files in one file
if [ "$HTML_FILE" = "no" ]; then
cat textfile* >> all.txt
fi
rm textfile* 2>/dev/null
cd ..
for f in $PRINT_FOLDER/*
do
if [ "$f" != "$PRINT_FOLDER/*" ]; then
LP_OUTPUT=$(lp $LP_OPTIONS "$f")
if [ "$?" != "0" ]; then
MAILTEXT="File $f could not be printed."
echo "$MAILTEXT" | mail -s "Print-Error" $MAIL_ADDRESS
fi
rm "$f"
PRINTED="yes"
else
if [ "$PRINTED" = "no" ]; then
echo "No printable Attachments" | mail -s "Print-Error" $MAIL_ADDRESS
fi
fi
# sleep added when upgraded to debian 9
sleep 25
done
if [ "$PRINTED" = "yes" ]; then
# remove the first 3 lines of the file because the sender will not be recognized as belonging to the email group
tail -n +4 $MAILFILE > "$MAILFILE.tmp"
# remove all the lines that start with "From". If not same error as the line before
sed '/^From/ d' < "$MAILFILE.tmp" > $MAILFILE
#define the email sender if not the email won't start
export EMAIL=info@mydomain.ch
mutt -s "Order received and printed" -a $MAILFILE -- $MAIL_ADDRESS1
rm $MAILFILE
fi
fi