User cron task does not work

If you setup some cron task from Sentora that does not work, ensure the following are correct:

CentOs

1) Ensure that the directory /var/spool/cron is owned by apache:apache and with permissions 770

2) Ensure that the directory /var/spool/cron/apache is owned by apache:apache and with permissions 660

3) The correct cron script path would look like:

  • your_domain_com/CRONFILE.php
  • your_domain_com/SUBFOLDER/SUBFOLDER/CRONFILE.php

There was a hickup with starting "/" required or not. It seems it was accepted until some last update of CentOs or Sentora but it MUST NOT be present now. In case of problem ensure the task path is correct with

crontab -u apache -l

Ubuntu

Ensure that the directory /var/spool/cron/crontabs is reachable by www-data-www-data

3) The correct cron script path would look like:

  • your_domain_com/CRONFILE.php
  • your_domain_com/SUBFOLDER/SUBFOLDER/CRONFILE.php

The same remark than to CenOs apply. In case of problem ensure the task path is correct with

sudo crontab -u www-data -l

By default, ubuntu is stup with cron log written in /var/log/syslog file. You can get them with:

grep CRON /var/log/syslog

To create a separate logfile for cron tasks, read here.

Windows

The starting slash MUST NOT be present. The script path would look like :

  • your_domain_com/CRONFILE.php
  • your_domain_com/SUBFOLDER/SUBFOLDER/CRONFILE.php

    Example for WHMCS, the script path is : your_domain_com/admin/cron.php
PenWant to help ? Click here to report mistake or to send complement to add.