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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print queue down message to email??

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi all,

Can someone point me in the right direction?
on AIX 4.3.3 using remote print queues to jetdirect servers...
when a print queue goes down can i have an email sent to my internet email or some other email besides local host?

and how would i do that? More on how to get the message into an email and then send it

Thanks
AnthonyF
 
Two issues:

1) Give AIX the ability to send mail to an external address.

2) Send an email notification if a print queue is down.

----

The first issue I'll leave alone for now. You should try sending yourself a test email first, and then troubleshoot that matter from there. "mail -v me@domain.tld" and see what it complains about.

The second issue: easy scripting. As I would have it implemented (and probably should get around to doing)

mkdir /var/semaphore

[tt]check.queues.sh
#!/bin/ksh

SEMDIR=/var/semaphore
EMAIL=me@domain.tld

lpstat -W | grep "DOWN" | while read QUEUE MISC
do
if test -f ${SEMDIR}/${QUEUE}.notify
then
echo "" > /dev/null
else
echo "" | mail -s "Print queue ${QUEUE} on `hostname` is down" ${EMAIL}
touch ${SEMDIR}/${QUEUE}.notify
fi
done

lpstat -W | grep "READY" | while read QUEUE MISC
do
rm ${SEMDIR}/${QUEUE}.notify 2>/dev/null
done[/tt]

crontab that script for however often you want it to check, every 5 minutes or whatever.
 
If I were using this method (wish I was, long story) I would have it attempt to bring up the queue, at least once. You might also throw in some testing if you feel like it, such as a ping, traceroute or what not to see if it's network or printer failure. But I like to have things auto'ed if possible, a personal preference. IBM Certified -- AIX 4.3 Obfuscation
 
That worked great!! Thank you.

And how is that I can have the script attempt to bring the queue back up before it emails me??

do i just insert an enable ${QUEUE} in there somewhere??

Thanks
Anthony
 
May require debugging. Written in notepad.

[tt]#!/bin/ksh

SEMDIR=/var/semaphore
EMAIL=me@domain.tld

lpstat -W | grep "DOWN" | while read QUEUE MISC
do
if test -f ${SEMDIR}/${QUEUE}.autoup
then
if test -f ${SEMDIR}/${QUEUE}.notify
then
echo "" > /dev/null
else
echo "" | mail -s "Print queue ${QUEUE} on `hostname` is down" ${EMAIL}
touch ${SEMDIR}/${QUEUE}.notify
fi
else
enable ${QUEUE}
touch ${SEMDIR}/${QUEUE}.autoup
fi
done

lpstat -W | grep "READY" | while read QUEUE MISC
do
rm ${SEMDIR}/${QUEUE}.notify 2>/dev/null
rm ${SEMDIR}/${QUEUE}.autoup 2>/dev/null
done[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top