• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Cron Job Email Address

S

Superman859

Guest
I have a few cron jobs that run very often, and I am not interested in receiving emails regarding them every time they run (I just realized I had 500,000 emails taking up 2gb space because of this at one address). However, I noticed that under preferences, email address for cron messages is required.

I read that if I am manually configuration the crontab file, I should be able to run a command as

env php -q /var/www/vhosts/site.com/subdomains/marketing/httpdocs/admin/cron/cron.php >> /var/www/vhosts/site.com/subdomains/marketing/httpdocs/admin/cron/cron.log

and this should simply pipe the output to a log file. This seems like it would be a better solution (an even better solution would not provide any output unless it failed. The job runs every minute, so that's either a lot of emails or a large log file. I'm only interested if it fails).

I tried setting up the cron job using plesk control panel and in the command field I simply used the line above. However, it doesn't appear to be working correctly. The log file remains empty, and the emails have stopped. I tried running

/etc/init.d/crond restart

as well, without any success.

Does anyone know a good solution for this situation, or at least what I may be doing wrong with trying to get it to go to a log file rather than email? I'm not sure how setting up the command as above in the control panel works or how the email address under preferences works (other than it is marked as required field). Is there a way to set this up appropriately using just the control panel, or will I need to manually edit the crontab file and not set it up in the control panel at all? I use the control panel for pretty much everything, so I'd like to stick with it if possible.

EDIT: The task is currently scheduled under the domain in the control panel. I did not configure it from the main 'server' scheduled tasks button.
 
Back
Top