Cron Job Delete Log Files
It is not recommended to immediately purge logfiles as they may be needed later for debugging, statistics or tracing an intrusion. While log shipping offsite may be overkill in a single VPS scenario, there are better approaches than simply deleting those. I suggest you look into logrotate or cronolog (Probably available as package on CentOS). With these packages you can set up rules how to process logfiles on a (usually) daily basis, like: Keep a week worth of logs, but compress all of them except today's.
See More On Stackoverflow
Dec 11, 2008 I'm new to cron. I have an Ubuntu 8.04 server and I would like to set up a cron job to delete the contents of /var/log everyday. How would I go about doing. Jun 14, 2005 delete files older than 30 days using cronjob. What i want to do is some sort of cron job comand or tiney php or cgi. Puyo pop fever windows. Cron Question - Delete files. Either run a PHP file that deletes all files after 24 hours using a cron job; Use the cron job command `rm` to delete all the files; I tried both ways and was unable to get my task completed. Here is the pic of cpanel scheduled task: I want to delete files from folder var/www/example.com/public/js/complied.