1

I am trying to create a cron job that deletes any temp files after certain periods of time.

In crontab I have this:

MAILTO:="my@e-mail.com"
@hourly /var/www/magento/cache.sh

And in cache.sh there is the following:

find /var/www/magento/var/cache/ -type f -mmin +120 -exec rm {} \;
find /var/www/magento/var/session/ -type f -mmin +120 -exec rm {} \;
find /var/www/magento/var/report/ -mtime +7 -exec rm -f {} \;
find /var/www/magento/var/tmp/ -mtime +1 -exec rm -f {} \;

However the e-mail output is this:

find: missing argument to `-exec'
find: missing argument to `-exec'
find: missing argument to `-exec'
rm: cannot remove `/var/www/magento/var/tmp/': Is a directory

I'm quite new to cron jobs, does anybody know what I am doing wrong here?

Thanks in advance :)

closed as off-topic by Marius Mar 2 '15 at 14:08

  • This question does not appear to be about the Magento e-Commerce platform within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I'm voting to close this question as off-topic because this is not really about Magento – Marius Mar 2 '15 at 14:08
0

sudo find /var/www/html/erp/var/log/ -type f -exec rm -rf {} +

  • Care to expand? – Alexander Sep 11 '14 at 11:39
  • this wil also work, find /var/www/html/erp/var/log/ -type f -exec rm {} \; i have doubt on the -mmin +120 – Jignesh Sep 11 '14 at 12:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.