Results 1 to 2 of 2
I have several websites that run on a Linux 2.6.9-22.ELsmp system. I am running OsCommerce on them and lately i have files name core.12345 (the numbers of course change with ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-29-2006 #1
- Join Date
- Apr 2006
Cron job programming help
I have several websites that run on a Linux 2.6.9-22.ELsmp system. I am running OsCommerce on them and lately i have files name core.12345 (the numbers of course change with the name) that appear to eat up disk space. The webmaster said that the files are caused by bad php programming. I need to have a cron job run daily to delete these files to keep them from eating up the disk space. I have access to the cron command via Cpanel. any help would be greatly appreciated.
- 04-29-2006 #2
The first point to remember with cron is that it has a shorter $PATH than most things, so you often have to specify a command's $PATH. In other words, if, for example, in FreeBSD, I have a script that I run from cron, that has a path of /usr/local/bin/ I have to specify /usr/local/bin/<program> in the script, or cron won't be able to find it.
As for your script, assuming that these files all start with the word core, and you have no other files with the word core in them, the following should work
find / -name "*core*" | xargs rm -f
You can test it first by changing xargs rm -f to xargs echo rm -f
Hopefully, your question is how to find and remove the files rather than how to set up a cronjob.
If the question is more about how to set up a cronjob rather than how to find and remove the files, you can take a look at this page on getmail for a better explanation about cronjobs.