02-23-2011
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
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
2. Shell Programming and Scripting
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
3. Cybersecurity
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
4. UNIX for Dummies Questions & Answers
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
5. Shell Programming and Scripting
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
6. Solaris
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
7. Shell Programming and Scripting
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
8. UNIX for Dummies Questions & Answers
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
9. Shell Programming and Scripting
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
10. Shell Programming and Scripting
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
SHOWQ(8) System Manager's Manual SHOWQ(8)
NAME
showq - list the Postfix mail queue
SYNOPSIS
showq [generic Postfix daemon options]
DESCRIPTION
The showq(8) daemon reports the Postfix mail queue status. It is the program that emulates the sendmail `mailq' command.
The showq(8) daemon can also be run in stand-alone mode by the superuser. This mode of operation is used to emulate the `mailq' command
while the Postfix mail system is down.
SECURITY
The showq(8) daemon can run in a chroot jail at fixed low privilege, and takes no input from the client. Its service port is accessible to
local untrusted users, so the service can be susceptible to denial of service attacks.
STANDARDS
None. The showq(8) daemon does not interact with the outside world.
DIAGNOSTICS
Problems and transactions are logged to syslogd(8).
CONFIGURATION PARAMETERS
Changes to main.cf are picked up automatically as showq(8) processes run for only a limited amount of time. Use the command "postfix
reload" to speed up a change.
The text below provides only a parameter summary. See postconf(5) for more details including examples.
config_directory (see 'postconf -d' output)
The default location of the Postfix main.cf and master.cf configuration files.
daemon_timeout (18000s)
How much time a Postfix daemon process may take to handle a request before it is terminated by a built-in watchdog timer.
duplicate_filter_limit (1000)
The maximal number of addresses remembered by the address duplicate filter for aliases(5) or virtual(5) alias expansion, or for
showq(8) queue displays.
empty_address_recipient (MAILER-DAEMON)
The recipient of mail addressed to the null address.
ipc_timeout (3600s)
The time limit for sending or receiving information over an internal communication channel.
max_idle (100s)
The maximum amount of time that an idle Postfix daemon process waits for an incoming connection before terminating voluntarily.
max_use (100)
The maximal number of incoming connections that a Postfix daemon process will service before terminating voluntarily.
process_id (read-only)
The process ID of a Postfix command or daemon process.
process_name (read-only)
The process name of a Postfix command or daemon process.
queue_directory (see 'postconf -d' output)
The location of the Postfix top-level queue directory.
syslog_facility (mail)
The syslog facility of Postfix logging.
syslog_name (see 'postconf -d' output)
The mail system name that is prepended to the process name in syslog records, so that "smtpd" becomes, for example, "postfix/smtpd".
Available in Postfix version 2.9 and later:
enable_long_queue_ids (no)
Enable long, non-repeating, queue IDs (queue file names).
FILES
/var/spool/postfix, queue directories
SEE ALSO
pickup(8), local mail pickup service
cleanup(8), canonicalize and enqueue mail
qmgr(8), queue manager
postconf(5), configuration parameters
master(8), process manager
syslogd(8), system logging
LICENSE
The Secure Mailer license must be distributed with this software.
AUTHOR(S)
Wietse Venema
IBM T.J. Watson Research
P.O. Box 704
Yorktown Heights, NY 10598, USA
SHOWQ(8)