At work I’m doing a bunch of printing of some large documents. I wanted a way of being notified when it was done printing. The action to take is up to you, I’m using curl to load a python CGI on a server to send an email/SMS to my phone. If you want to watch your non-default printer – just use the -P flag to lpq.
#!/bin/bash
LPQSTAT=lpq | head -1 | awk '{ print $NF }'
while [ $LPQSTAT = 'printing' ];do
echo $LPQSTAT
sleep 5
LPQSTAT=lpq | head -1 | awk '{ print $NF }'
done
curl ....
exit 0
0 comments ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment