Shell Script with mailq


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell Script with mailq
# 1  
Old 02-23-2011
Question Shell Script with mailq

Hi All,

I'm a unix starter.. Need your help please. I need to write a simple shell script to implement mail queue size check.

Pseudo code:

Run mailq command

If the queue size is greater than the predefined parameter (say 10), print message like : CRITICAL: Mail queue is XX . And exit 2

If the queue size is less than the predefined parameter (say 10), print message like : OK: Mail queue is XX. And Exit 0
# 2  
Old 02-23-2011
Withdrawn -- sounds too much like Homework

Last edited by Chubler_XL; 02-23-2011 at 11:05 PM.. Reason: Added shell version
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mailq regex match

Hi, # mailq | awk '{match($0, /quota/)} {print $0}' | head -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- 9A6A7DE117E 84309 Sat Sep 30 14:14:50 alerts-noreply+xxxxx=xxx.sg@xxx.xx.xxx (host alt1.gmail-smtp-in.l.google.com said: 452-4.2.2 The email account that you... (2 Replies)
Discussion started by: ashokvpp
2 Replies

2. Shell Programming and Scripting

How to write config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

3. UNIX for Dummies Questions & Answers

How to write Config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

4. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies

5. Solaris

solaris 10u9 + sendmail 8.14.5 mailq grows, deferred messages

hello, I am using solaris 10 and sendmail 8.14.5 Main Problem i have growing (to 1500+ mails) mailq, and mailq consists of mails older then even 1 month. i have forced mailq by sendmail -q -v and messages went out. but it looks like, when messages enter to mailq they are not processed any... (0 Replies)
Discussion started by: lpic.lt
0 Replies

6. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following : host01> ssh host02 autoexec.sh autoexec.sh include nohup command like follwing : nohup /home/jack/deletedata.sh & after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies

7. UNIX for Dummies Questions & Answers

mailx, why all my mail goes to mailq?

Hi, I sending mail like this: mailx -s "test" -r "from@me.com" to@you.com and I have update the /etc/mail/sendmail.cf with: DSsmtp-relay-nx-vip.xxx.yyy.com (this path is working on the old server) But all I mail goes to queue. What do I miss here? Regards Mehrdad (1 Reply)
Discussion started by: mehrdad68
1 Replies

8. Cybersecurity

found exploit mailserver through mailq?

First of all an appeal on all specialists to be understandfull with me, newbie. I have a RaQ 550 that I have to admin bymyself. I have executed mailq and found out that there are mails in the queu that I did not sent. Is someone exploiting my server? Here is an example of the report: ... (1 Reply)
Discussion started by: rolandk
1 Replies

9. Shell Programming and Scripting

AWK and mailq

I need a simple script to parse the output of the mailq command and find emails from overseas addresses and delete them (ie user@xxx.co.uk, user@xxx.yyy.jp). I found something close: mailq | tail +2 | awk 'BEGIN { RS = "" } / *.co.uk / {print $1} ' | tr -d '*!' | postsuper -d - but I... (2 Replies)
Discussion started by: Retski
2 Replies

10. UNIX for Dummies Questions & Answers

mailq

Dear guys !! Problems do not finish .. i have sun solaries 7 ,, ultra2 ,, mail server .. am checking server mailq now and it is loaded ,, so many requests up to 300 request . i checked netstat and did not find many or starnge smtp packets . but when i execute mailq i get mailq as... (3 Replies)
Discussion started by: tamemi
3 Replies
Login or Register to Ask a Question