try another color:
try another fontsize: 60% 70% 80% 90%
Eichis Weblog
come in and open your mind ;)

linux bash script: brothers netzwork printer status to desktop or terminal

Its just a small script, but you can get the status from the printer display on a terminal or maybe in your desktop bar. I use it with a Brothers HL-5350 DN  in my housing project. Now i have a notification, when its time to refill the paper or stuff like that.
 
You have to configurate the IP, thats all.
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

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.