
Here is it:
#!/bin/bash
# Script download page from Brother-networkprinter interface and cut out and paste the printerstatus####### CONFIGURATION ####################
# PLEASE SET IP OF PRINTER
IP_PRINTER=192.168.xxx.xxx#download the main.html of printer and cut out the |status-field| and past it
wget -qO - http://$IP_PRINTER/printer/main.html | awk -F';' 'NR == 224 {split($2, fields, "&"); print fields[1]}'#checks the wget error; maybe printer off or IP wrong?
if [[ ${PIPESTATUS[0]} != 0 ]]; then
echo "printer off?"
exit 1
fi
At the moment, the script only shows the first word of the printer display, that means:
If there is a "no paper" on the display, it only shows "no". Doesn't matter, but maybe soneone knows "awk" better then me and can send me a patch ;)



Kommentar hinzufügen