Sponsored Content
Full Discussion: Clearing Mail Queue
Top Forums UNIX for Dummies Questions & Answers Clearing Mail Queue Post 21541 by Perderabo on Saturday 18th of May 2002 07:28:04 AM
Old 05-18-2002
The shell expands that * into a list of filenames and then tries to run the rm command with that list. But there's a limit to how long that list can be and you exceeded it.

Since you are using the full path, you might try a relative path instead:
Code:
cd /var/spool/mqueue
rm *

Now each individual file no longer has the /var/spool/mqueue/ prefix so the expanded command is much shorter. But if this is still too long, you can try this...
Code:
cd /var/spool/mqueue
ls | xargs rm

The ls produces a list of file names which xargs reads. It then assembles them into a bunch of rm commands. It knows how long each one can be and it won't assemble a command that is too long.

But are sure that you want to do this? You are going to discard all of your mail! My idea of clearing the queue is
Code:
/usr/lib/sendmail -q -v


Last edited by rbatte1; 11-17-2016 at 10:59 AM.. Reason: Added CODE tags
This User Gave Thanks to Perderabo For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

MyDoom in mail queue

Is there someone out there that has a script for cleaning up the mail queue after viruses such as MyDoom? (5 Replies)
Discussion started by: pmj1970
5 Replies

2. Shell Programming and Scripting

shell script needed for mail queue notification

Hi shell experts, I would like to have a shell script running in a redhat server for monitoring the mailqueue status. I have already installed the qmHandle and I am using it to get a status of the mail queue in daily basis. I am executing the qmhandle in the cron. Now I am planning to execute... (10 Replies)
Discussion started by: Nightman
10 Replies

3. UNIX for Advanced & Expert Users

mail is not sent, instead just coping into /var/spool/queue dir

Hi, I have some problems w/ the sendmail. I see that messages are queued in the /var/spool/mqueue and they are never sent to the recipients. This problem just suddenly started without any modifications in the current configuration. I already started and stop the sendmail and it did not help.... (3 Replies)
Discussion started by: ktanya
3 Replies

4. IP Networking

postfix - reinject mail to postfix from hold queue directory

hi all. Am using smtpd_recipient_restrictions & check_recipient_access in postfix. The hash file looks like this: emailaddress1 HOLD emailaddress2 HOLD The aim is to place email from these recipients in the hold directory,check them then reinject them back in postfix on some... (0 Replies)
Discussion started by: coolatt
0 Replies

5. Shell Programming and Scripting

flush the mail queue

Hi Guys, My mail queue is showing a mail. I want to flush the queue. Can you let me know how to flush the mail queue. Regards, Magesh (12 Replies)
Discussion started by: mac4rfree
12 Replies

6. AIX

clearing PVID

HI admins, I am not able to clear pvid .I am getting below error. chdev -l hdisk273 -a pv=clear Method error (/usr/lib/methods/chgdisk): 0514-047 Cannot access a device. pv The disk is from SAN. I can clear remove the disk using rmdev.But if i run cfgmgr , this disk apperas... (2 Replies)
Discussion started by: newaix
2 Replies

7. UNIX for Dummies Questions & Answers

Mail Queue refilling

Hello I'm using Cent OS6 and a webmin interface I've had an issue where over 1 million emails were queued in the sendmail mail queue. I found a thread on here from 2002 explaining how to delete them all and it worked great. Thanks Perderabu unix-for-dummies-questions-and-answers /... (0 Replies)
Discussion started by: bullbreed
0 Replies

8. Shell Programming and Scripting

Check pending mail in mail queue

I know the command mailq can check the pending mail in mqueue , and also have another command to check POSIX mail queue in server , now I will regularly check the mqueue manually , it is time consuming , would advise the script that could help to check the mail queue , and then send the details to... (3 Replies)
Discussion started by: ust3
3 Replies

9. Shell Programming and Scripting

Check mail queue

We use Redhat server , we always use mailq to check any pending mail in mailq , when run the command mailq , it shows all existing pending mail would advise how to write a script to show the pending mails which are older than 24 hours , ( if possible , then send this pending mail info to... (9 Replies)
Discussion started by: ust3
9 Replies

10. UNIX for Dummies Questions & Answers

Printer queue not clearing

Hi I have installed an HP X451dw printer on our network and want to print from Sco Openserver v6 The printer produces correct output but then repeats until the queue is manually stopped. :confused: It is using a netcat/dumb interface Any advice on how to persuade it to only print once... (5 Replies)
Discussion started by: David Holmes
5 Replies
mqueue.h(3HEAD) 						      Headers							   mqueue.h(3HEAD)

NAME
mqueue.h, mqueue - message queues SYNOPSIS
#include <mqueue.h> DESCRIPTION
The <mqueue.h> header defines the mqd_t type, which is used for message queue descriptors. This will not be an array type. A message queue descriptor may be implemented using a file descriptor, in which case applications can open up to at least OPEN_MAX file and message queues. The <mqueue.h> header defines the sigevent structure (as described in <signal.h>, see signal.h(3HEAD)) and the mq_attr structure, which is used in getting and setting the attributes of a message queue. Attributes are initially set when the message queue is created. A mq_attr structure has the following members: long mq_flags message queue flags long mq_maxmsg maximum number of messages long mq_msgsize maximum message size long mq_curmsgs number of messages currently queued Inclusion of the <mqueue.h> header may make visible symbols defined in the headers <fcntl.h>, <signal.h>, <sys/types.h>, and <time.h>. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
fcntl.h(3HEAD), signal.h(3HEAD), time.h(3HEAD), types.h(3HEAD), attributes(5), standards(5) SunOS 5.10 30 Aug 2002 mqueue.h(3HEAD)
All times are GMT -4. The time now is 07:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy