Skip to content

Instantly share code, notes, and snippets.

@nfreader
Created August 21, 2012 20:32
Show Gist options
  • Save nfreader/3419176 to your computer and use it in GitHub Desktop.
Save nfreader/3419176 to your computer and use it in GitHub Desktop.
Gets status of toner cartridges in an HP LaserJet 2600n
#!/bin/bash
PRINTER = 192.168.1.65;
curl http://192.168.1.65/SSI/supply_status_info.htm | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' > /tmp/printer;
BLACK=`grep -A 1 "Black Print Cartridge" /tmp/printer | grep %`
echo Black: $BLACK;
YELLOW=`grep -A 1 "Yellow Print Cartridge" /tmp/printer | grep %`
echo Yellow: $YELLOW;
CYAN=`grep -A 1 "Cyan Print Cartridge" /tmp/printer | grep %`
echo Cyan: $CYAN;
MAGENTA=`grep -A 1 "Magenta Print Cartridge" /tmp/printer | grep %`
echo Magenta: $MAGENTA;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment