how to delete more than 300.000 mails

Discuss the Scalix Server software

Moderators: ScalixSupport, admin

arsenet
Posts: 142
Joined: Fri Jan 11, 2008 1:31 pm
Location: Madrid - Spain
Contact:

how to delete more than 300.000 mails

Postby arsenet » Tue May 11, 2010 11:40 am

Hi,
Yesterday one user infected by a virus, sen more than 500.000 spam mails.
When we detected, move from UNIX queue to archive to clen UNIX queue, now, who can i delete that mails? 98% are spam, but not all.
i see in the wiki the message to delete mails from queue using omstat, but take mora than 4 minutes to delete one mail, and queue.manager 100%.

Very much thanks
Red Hat Enterprise 5.0
Scalix Hosted Edition 11.46
David de Pedro, Thecnical
ArSeNet Servicios en Internet, S.L.
sat@arsenet.com

ltward
Posts: 309
Joined: Tue Jan 15, 2008 1:54 pm
Contact:

Re: how to delete more than 300.000 mails

Postby ltward » Tue May 11, 2010 11:58 am

If the messages are still in the queue then omstat is your best choice. As the queue gets smaller, the deletions will happen faster.

You could use omqdump and delete ALL of the messages (including the good ones) but that will also take a long time on such a big queue, and it will use system resources.

You might want to wait until after business hours, when users are not on the system as much, and run the omstat command then.

If the messages are already delivered in user accounts, omtidyallu is your best choice.

mikethebike
Posts: 566
Joined: Mon Nov 28, 2005 4:16 pm
Location: England

Re: how to delete more than 300.000 mails

Postby mikethebike » Wed May 12, 2010 9:36 am

The problem is that omqstat runs through the entire queue.

What you could is move all the mails to another queue that has nothing in it (smerr maybe) and then process them there. It will take a while to create the file, but you will only stat the queue once. Make sure NOTHING is added or removed from the queue while you do this.

omstat -q smerr > /tmp/workfile

cat /tmp/workfile |while read line;do
echo $line |grep -q <string from bad message subject>
if [$? -eq 0 ]
echo 2
else
echo 1
done > /tmp/workfile2

then use omresub to resub them to service router

omresub -q smerr -i < /tmp/workfile2

Mick

arsenet
Posts: 142
Joined: Fri Jan 11, 2008 1:31 pm
Location: Madrid - Spain
Contact:

Re: how to delete more than 300.000 mails

Postby arsenet » Wed May 12, 2010 11:51 am

/root/borrarfromomstat2: line 2: syntax error near unexpected token `newline'
/root/borrarfromomstat2: line 2: `echo $line |grep -q <My Last Wish>'
Red Hat Enterprise 5.0
Scalix Hosted Edition 11.46
David de Pedro, Thecnical
ArSeNet Servicios en Internet, S.L.
sat@arsenet.com

arsenet
Posts: 142
Joined: Fri Jan 11, 2008 1:31 pm
Location: Madrid - Spain
Contact:

Re: how to delete more than 300.000 mails

Postby arsenet » Wed May 12, 2010 12:46 pm

ok, i make some changes and now work, but i have at least 5 diferent spam mails, and this only work for one
Red Hat Enterprise 5.0
Scalix Hosted Edition 11.46
David de Pedro, Thecnical
ArSeNet Servicios en Internet, S.L.
sat@arsenet.com

mikethebike
Posts: 566
Joined: Mon Nov 28, 2005 4:16 pm
Location: England

Re: how to delete more than 300.000 mails

Postby mikethebike » Wed May 12, 2010 2:21 pm

you could edit the file directly, and search/replace each line with either "1" or "2", so you end up with a file containing somthing like:

1
2
2
2
1
1
1
1

Then run omresub against that file.

omresub -q smerr -i < /tmp/workfile2

arsenet
Posts: 142
Joined: Fri Jan 11, 2008 1:31 pm
Location: Madrid - Spain
Contact:

Re: how to delete more than 300.000 mails

Postby arsenet » Wed May 12, 2010 7:32 pm

yes but we are talking about 300.000 mails, that only about 2000 are ok
Red Hat Enterprise 5.0
Scalix Hosted Edition 11.46
David de Pedro, Thecnical
ArSeNet Servicios en Internet, S.L.
sat@arsenet.com

mikethebike
Posts: 566
Joined: Mon Nov 28, 2005 4:16 pm
Location: England

Re: how to delete more than 300.000 mails

Postby mikethebike » Thu May 13, 2010 4:52 am

Hi,

if you use an editor, you do not need to edit each line individually.

for example, if you are using vi editor or sed, do a search and replace of all lines that contain the message subject you want to delete. Editing the entire file of 300,000 should take no more than a few minutes.

g/subject line/s/^.*$/2/

or using sed

cat /tmp/workfile |grep "subject line" |sed 's/^.*$/2/g' > /tmp/workfile2

Mick

arsenet
Posts: 142
Joined: Fri Jan 11, 2008 1:31 pm
Location: Madrid - Spain
Contact:

Re: how to delete more than 300.000 mails

Postby arsenet » Thu May 13, 2010 5:34 am

if i use cat method, all line change to 2
Red Hat Enterprise 5.0
Scalix Hosted Edition 11.46
David de Pedro, Thecnical
ArSeNet Servicios en Internet, S.L.
sat@arsenet.com

mikethebike
Posts: 566
Joined: Mon Nov 28, 2005 4:16 pm
Location: England

Re: how to delete more than 300.000 mails

Postby mikethebike » Thu May 13, 2010 5:59 am

ooops, I should have checked that command!!
sorry, please see my previous post for that method, no need to use sed:

cat /tmp/workfile |while read line;do
echo $line |grep -q <string from bad message subject>
if [$? -eq 0 ]
echo 2
else
echo 1
done > /tmp/workfile2

Mick

ltward
Posts: 309
Joined: Tue Jan 15, 2008 1:54 pm
Contact:

Re: how to delete more than 300.000 mails

Postby ltward » Thu May 13, 2010 1:25 pm

Good point about stating the queue more than once.

I really like the idea of making an input file for omresub, Mick. Clever!


Return to “Scalix Server”



Who is online

Users browsing this forum: No registered users and 25 guests

cron