I have a network printer, and it’s surprising how often I print a job and then find the printer is not switched on, and the print job gets put in HOLD state. Using “lpstat -l” one can view the print job status, and with the “lp” command can resume the print job. But I’m idle, so I created this very simple script to do it all in one command – I call it “lprel”.
#!/bin/sh # # script to resume the top job on the default printer queue j=`lpstat | head -1 | cut -d' ' -f1` if [ "$j" = "" ]; then echo 1>&2 "No jobs in queue." exit 1 fi echo "releasing "$j"..." lp -i "$j" -H resume lpstat -l