remove one file each 24 hour time period

I have a file created by "Spam Assassin" called "almost-certainaly-spam" I would like to remove it from my user directory each 24 hour peroid
Can someone help me with a script on my Linux Red Hat ES3 server to do this?
Thank you in advance.
Keith Henriques
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

As the user who holds the file do:
crontab -e

put a line like:
0 0 * * * rm ~/almost-certainly-spam

This will remove the file every day on 00:00.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
keitharisAuthor Commented:
Thank you:
where will I find the crontab file I created When I want to remove the program?
Keith Henriques
keitharisAuthor Commented:
When I use the crontab -e command and create a file as you indicate I get a:
bad :0: day of month notice and cannot actualy create a "crontab"
Thank yo for your help.
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

If you later want to remove the auto-delete command, simply execute 'crontab -e', delete the line, and save the result.

FYI: The crontab files are in /var/spool/cron
keitharisAuthor Commented:
Hello again:
I used 59 12 and was able to install the new crontab
Will I have a problem removing it if I ever want to?
Keith Henriques
No, you won't have a problem removing the crontab entry, see above.
keitharisAuthor Commented:
Sorry jlevie I got a mixed up as I wanted to award teh points to XoF as this was teh basic answer i just had to figure
out how the time #1 entry worked in crontab.
Thank you for your kind considerations
Keith Henriques
That's quite alright. I just wanted to be fair about it and give you a chance to award the answer to XoF.
Hey guys,

I'm quite impressed, although 500 points are quite a lot for that easy one.... Thanx!
But nevertheless I'm still wondering, why the "0 0 * * *" line produced errors - at my site this syntax works properly....
I could reproduce the "bad month" error with that line:
"0 0 0 * *"
Perhaps a typo in the first try?


keitharisAuthor Commented:
The way we ended up works like a charm. No sense in fixing things that arn't broken, I figure.
Thank you for providing a solution that works!
Keith Henriques
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.