Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to check lpstat -o

Status
Not open for further replies.

Scunningham99

Programmer
Sep 20, 2001
815
GB
does anyone have an existing script that can be put in the cron whcih checks the print queue ie lpstat -o and checks if it exceeds X amount of jobs

Sy UK
 
What have you tried so far and where in your script are you stuck ?
Tip: man wc

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
N=`lpstat -o |wc -l |awk '{ print $1 }'`
echo $N

if [ $N -gt 20 ]; then

echo "More than 20 Jobs in the Print Queue!!"

fi;



Sy UK
 
Try this...
Code:
#!/bin/ksh

if (( $(lpstat -o |wc -l) > 20 ))
then
    print "More than 20 Jobs in the Print Queue!!"
fi

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top