Cron Job auto delete emails older than X days in a domain
Hi,
I try to delete all email arrived of 1 month old of a specific domain with a cron job I tried with this commands:
I have been reading a lot in internet, I read and search in this forum but nothing works for me. My host it a VPS of Godaddy I don't know if this influences in the command I read these entries previously and others from internet: Possible to auto delete old emails after x number of days? Deleting Mails with Cron ??? Some errors sending to my email are with different commands: find: missing argument to `-exec' find: unknown predicate `--delete' find: `/home/mail/MYDOMAIN.COM/': No such file or directory
/usr/bin/archivemail -quiet -delete -days 30 /home/USERNAME/mail/MYDOMAIN.COM/find /home/USERNAME/mail/MYDOMAIN.COM/*/cur -type f -mtime +30 -exec rm -f {} \;find /home/mail/MYDOMAIN.COM/*/ -quiet -delete -days 30find /home/mail/MYDOMAIN.COM/ -type f -mtime +7 -deleteI have been reading a lot in internet, I read and search in this forum but nothing works for me. My host it a VPS of Godaddy I don't know if this influences in the command I read these entries previously and others from internet: Possible to auto delete old emails after x number of days? Deleting Mails with Cron ??? Some errors sending to my email are with different commands: find: missing argument to `-exec' find: unknown predicate `--delete' find: `/home/mail/MYDOMAIN.COM/': No such file or directory
-
Hello :) The following thread should help: Having issues getting cron job to work Remember that values such as "mydomain" are referring to your actual domain name. Thank you. 0 -
Thank you for answer :) and yes I replace USERNAME and MYDOMAIN.COM as my user name and the domain what I want delete all emails. I read the entry but did not work, I'm so newbie and I don't understand a lot the commands but I try. The path what I think is the correc for me is (because I see the path in my host server): /home/USERNAME/mail/MYDOMAIN.COM/*/
because when I write the code previously put they don't send me error in the path, but in the command code after send me errors. I have been reading what mean each word in the commands but nothing I don't have idea why don't work :(0 -
Do you see any output if you manually enter the "find" command? Could you send me a private message of the exact command you are using? Thank you. 0 -
Sorry but I can't send PM, this error out: But anyway this is the code that I wanted send you :) The path what I think is the correct is: find /home/usernamehere/mail/example.com/*
but the commands I don't know why don't works :( well, this are the commands what I used :find /home/mail/example.com/*/ -quiet -delete -days 30 find /home/mail/example.com/ -type f -mtime +7 -delete "quiet "delete "months 1 /home/iqmarkethink/mail/example.com/*/
My user is:usernamehere and my domain: example.com Really thanks again for you help, I'm soooooooo newbie in this :oops:0 -
Your "find" commands do not appear to use the correct paths. It's searching in "/home/mail" which is not a valid directory location. Thank you. 0 -
Try the below url, it will work for you. Long time back, I have deleted manually and you can do the same via cron also. How to Delete Files Older Than x Days in Linux | 2daygeek.com 0
Please sign in to leave a comment.
Comments
6 comments