Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Need Help with a Cron Job
RTCruiser
post Jul 12 2007, 09:35 AM
Post #1


Enlightened
*

Group: Members
Posts: 58
Joined: 14-July 06
Member No.: 22,506



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.
Go to the top of the page
 
+Quote Post
BlueFusion
post Jul 12 2007, 09:38 AM
Post #2


Fellow
**

Group: Members
Posts: 173
Joined: 11-December 06
From: Cleveland, Ohio / BGSU Bowling Green, Ohio
Member No.: 25,561



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 * * *


--------------------
The Planet customer since May, 2004:
- Dual Xeon 2.8GHz HT // 2GB RAM // 120GB HDD // 160GB HDD // RedHat Enterprise 4 // cPanel
EV1 Private Rack customer since December, 2006:
- 1x Dual Dual-Core Opteron 265 // 2GB RAM // 3x73GB SCSI HDD // RAID 5 // Red Hat Enterprise 4
- 4x Dual Dual-Core Opteron 265 // 2GB RAM // 2x73GB SCSI HDD // Red Hat Enterprise 4
- 2x Dual Dual-Core Opteron 2212 // 2GB RAM // 2x146GB SAS HDD // Red Hat Enterprise 4
- Foundry ServerIronXL Load Balancer // Cisco PIX 525 Firewall // Gigabit Switch // Gigabit Uplink
Go to the top of the page
 
+Quote Post
RTCruiser
post Jul 12 2007, 02:19 PM
Post #3


Enlightened
*

Group: Members
Posts: 58
Joined: 14-July 06
Member No.: 22,506



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!
Go to the top of the page
 
+Quote Post
James Jhurani
post Jul 13 2007, 06:01 AM
Post #4


SuperGeek
Group Icon

Group: The Planet Staff
Posts: 1,696
Joined: 27-December 05
Member No.: 19,248



I would suggest full path to rm, since cron does not have any ENV settings.


--------------------
"The average person thinks he isn't." -- Father Larry Lorenzoni


James Jhurani
Managed Hosting
http://www.theplanet.com
Go to the top of the page
 
+Quote Post
BlueFusion
post Jul 13 2007, 08:38 AM
Post #5


Fellow
**

Group: Members
Posts: 173
Joined: 11-December 06
From: Cleveland, Ohio / BGSU Bowling Green, Ohio
Member No.: 25,561



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.


--------------------
The Planet customer since May, 2004:
- Dual Xeon 2.8GHz HT // 2GB RAM // 120GB HDD // 160GB HDD // RedHat Enterprise 4 // cPanel
EV1 Private Rack customer since December, 2006:
- 1x Dual Dual-Core Opteron 265 // 2GB RAM // 3x73GB SCSI HDD // RAID 5 // Red Hat Enterprise 4
- 4x Dual Dual-Core Opteron 265 // 2GB RAM // 2x73GB SCSI HDD // Red Hat Enterprise 4
- 2x Dual Dual-Core Opteron 2212 // 2GB RAM // 2x146GB SAS HDD // Red Hat Enterprise 4
- Foundry ServerIronXL Load Balancer // Cisco PIX 525 Firewall // Gigabit Switch // Gigabit Uplink
Go to the top of the page
 
+Quote Post
James Jhurani
post Jul 13 2007, 10:28 AM
Post #6


SuperGeek
Group Icon

Group: The Planet Staff
Posts: 1,696
Joined: 27-December 05
Member No.: 19,248



Good to know, i've always used full path out of habit.


--------------------
"The average person thinks he isn't." -- Father Larry Lorenzoni


James Jhurani
Managed Hosting
http://www.theplanet.com
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 31st July 2010 - 07:38 AM