Help - Search - Members - Calendar
Full Version: Need Help with a Cron Job
The Planet Forums > System Administration > HOWTOs
RTCruiser
One of my clients is using a program that regularly creates HUGE core files that I have to manually delete before his domain exceeds it's quota.

I'd like to create a cron job that goes in each night and deletes them but my cronjob skills are such that I'm a little nervous about creating one that deletes files. So I'd like a little help here.

Does this look like the correct format:

30 12 * * * rm /home/[domian]/public_html/cgi-bin/dada/core.*

Thanks for any advice.
BlueFusion
I'd use rm -f to ensure that it forces a delete without it prompting a user (that isn't there).

And if your server is CST, it will run at 12:30PM (afternoon) not night. If you want it to run at 12:30AM (night), then that would be 30 0 * * *
RTCruiser
QUOTE (BlueFusion @ Jul 12 2007, 11:38 AM) *
I'd use rm -f to ensure that it forces a delete without it prompting a user (that isn't there).

And if your server is CST, it will run at 12:30PM (afternoon) not night. If you want it to run at 12:30AM (night), then that would be 30 0 * * *



Very cool. Thanks for your input!
James Jhurani
I would suggest full path to rm, since cron does not have any ENV settings.
BlueFusion
I do believe that RH/CentOS and other distros have $PATH defined. I've only ever had to use a full path in crontab on Solaris.
James Jhurani
Good to know, i've always used full path out of habit.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.