Shell script to find the print queue on Linux Server


In this post I am going to share a shell script to find if the print queue on a server of all printers is more than 50. You can customize based on your requirement.


Sample Code:

cat /root/bin/printstatus.sh

#!/bin/bash
lpstat `lpstat -a | awk '{print $1}'` > printq.lst
qcount=`wc printq.lst | awk '{print $1}'`
if [ $qcount -gt 50 ]
then
  mail -s "Print Queue is more than 50 in funebs122" support@funoracleapps.com < printq.lst
fi





If you like please follow and comment