Delete Old Spam Emails Custom Cron


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Delete Old Spam Emails Custom Cron
# 1  
Old 07-29-2008
Delete Old Spam Emails Custom Cron

Hey Guys,

I've done some research however I got stuck. My goal is to create a cron job that runs every hour and goes through all web accounts on my server and deletes spam emails that are older than 3 days. This is what I came up with:

Code:
0 * * * * find /home/*/mail/*/*/.spam/cur/* -type f -mtime +3 -exec rm{}

HOWEVER Smilie ... when i test just a piece of that command:

Code:
find /home/*/mail/*/*/.spam/cur/* -type f -print |xargs ls|wc -l

I get the pretty "Argument list too long" error. I dont want to proceed setting up that cron job until I'm 100% sure that it is correct and will work on all user accouts with some of them having over 50,000 spam emails in ther .spam/cur folder. Any advice?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Emergency UNIX and Linux Support

How to prevent emails as spam?

If an email is sent from our application server(running on AIX) to an id that is outside of the organization like gmail etc, and if gmail should not treat the mail as spam, what has to be done from unix level? (7 Replies)
Discussion started by: ggayathri
7 Replies

2. Shell Programming and Scripting

How to disable cron emails, but only for logrotate only not for other logs?

Guys, is there a script or command? how to disable cron emails, but only for logrotate only not for other logs (3 Replies)
Discussion started by: kenshinhimura
3 Replies

3. Shell Programming and Scripting

Shell Script to Delete Old Cron Jobs

I have a cron entry to deploy a website portal from a staging server to a series of production servers on a weekly basis. On occasion, a random office worker who knows nothing about Linux let alone cron, will be tasked to update news picks on the staging server and then run a manual deployment... (2 Replies)
Discussion started by: AndrewT
2 Replies

4. Shell Programming and Scripting

Using cron to delete directories 90 days old

We use Solaris 10 x86 and I want to use a cron job to remove directories +90 old. Currently I have the command below but it only cleans the files and keeps the directory. What am I doing wrong? /opt/tesk/batch/kit/archive/* -mtime +90 -exec rm -r {} \: Thank you (3 Replies)
Discussion started by: oh-daa
3 Replies

5. UNIX for Dummies Questions & Answers

Cron to delete email help needed

I would like to know if I can place a cron job (and what it might be of course) to delete all the mail in an inbox? Here are the servers specs: Operating systemLinuxService StatusClick to ViewKernel version2.6.28.9Machine Typei686Apache version2.2.11 (Unix)PERL version5.8.8Path to... (2 Replies)
Discussion started by: markmatu
2 Replies

6. UNIX for Dummies Questions & Answers

Cron job to delete files

Hi everyone! I'm sorry, I'm a total noob but would really appreciate any advice or help. I want to create a cron job that would run every hour and would look inside a few different folders. If any new files were created within those folders within the last hour they would be destroyed, but any... (2 Replies)
Discussion started by: jessn
2 Replies

7. UNIX for Dummies Questions & Answers

CRON. How to delete files within a directory

I'd like to delete ALL files on a daily basis within a directory that are over a day old. Anyone know how I can automate this through Cron as I have 146 websites to administer. I've tried... 30 02 * * * /home/myspace/tmp/webalizer -atime + 1\! -type d -exec rm -f {} \; but all i get is an... (1 Reply)
Discussion started by: southoxon
1 Replies

8. UNIX for Dummies Questions & Answers

How do we delete spam email on mmdf

Please advise on how to delete spam email from mmdf email, and The Unix spec below: System = SCO_SV Release = 3.2v5.0.5 (2 Replies)
Discussion started by: esh
2 Replies
Login or Register to Ask a Question
apticron(1)						      General Commands Manual						       apticron(1)

NAME
apticron - Generate a mail listing packages which are pending an upgrade SYNOPSIS
apticron [--cron] DESCRIPTION
apticron is a shell script which generates a mail with a list of all packages currently pending an upgrade, as well as summary of changes - using apt-listchanges - to a configurable Email address. apticron is mainly intended for automatic notification of pending security updates but can also be used in many other situations where timely updates are necessary. The --cron option is only meant to be used when invoked by cron in order to run no more than once a day. FILES
/etc/apticron/apticron.conf Configuration file, Email address to mail and profile for use with apt-listchanges are configurable. /etc/cron.d/apticron Cron job for executing apticron daily. /etc/cron.daily/apticron Fallback cron script for executing apticron (if no crond running or system down at designated time). /var/lib/misc/apticron.cron Time stamp file used by apticron when invoked with --cron option. SEE ALSO
apt-get(8), apt-listchanges(1), cron(8) AUTHOR
Apticron was initially developed by Colm MacCarthaigh <colm.maccarthaigh@heanet.ie> with contributions from Marc Sherman <msherman@projec- tile.ca>. Since 2006 it is maintained and improved by Tiago Bortoletto Vaz <tiago@debian.org>. apticron(1)