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

how to check for number of messages in queue?

Status
Not open for further replies.

dwcasey

MIS
Oct 31, 2002
179
0
0
US
I am working on a script to monitor the number of messages in the mail-queue.

Currently, I check the /var/spool/mqueue for the number of files and have set a threshold.

Of course, this number is very realistic because of all the different file types.

Is there a sendmail command that will return the number of messages in the queue?

I've run sendmail -q -v and can get the number of messages (sequence 1 of 134), but it "hangs" the screen and does not return a prompt.
 
I think 'mailq' would be a more useful command. It might still be simpler to do what you are already doing, but restrict your search to the 'q' file type. In other words

ls /var/spool/mqueue/q* 2>/dev/null | wc -l

should give you the number of messages in the queue.

 
That's the command I needed. I put it into a nice little script to show me the number give at the top of the output from that command.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top