Cron Job Hosting Rules

Hi guys i have runing my SuiteCRM but they have a rule about cron job right now

[color=#000000]Important:[/color] [color=#ff0000]Please do not set your cron jobs to run in less than 30 mins. This is agains the Terms of use and may cause server overloads. Such crons will be reset.

What i can do to run SuiteCRM Schedulers

Right now i have set the follow cron job

0,30 * * * * php-cli /home/domain/public_html/suitecrm/cron.php

You think will work?

Just run it each hour or half hour and you will be fine.

I run my SuiteCRM cron job each hour. Yes, if I add a new lead or account it won’t be searchable until chron runs, but it will be in the ‘recently views’ menu list… or in the lead/detail list so it’s no big deal. I think it is silly to run it every minute… waste of server resources for most people.

Ok thanks can you tell me the right Cron Job parameter

witch one is

0,30 * * * * php-cli /home/domain/public_html/suitecrm/cron.php
0,30 * * * * cd php-cli /home/domain/public_html/suitecrm/cron.php

On the first one you might want to give it the full path to where php-cli is located.

I put the command in a shell script because I run FreeBSD. Here is the crontab listing:

54 */1 * * * /bin/sh /usr/home/xxxxxxxxxxx/

I need to run this via the the bash shel which is why I need the /bin/sh qualifier.

This runs the job at 54 minutes past the hour (or 6 minutes before the hour) each hour, every day. I’m not sure what the */1 parm does or if it is needed, but it works.

Using third party webcron like EasyCron allows scheduling cron jobs run every minute.

Using third party webcron like EasyCron allows scheduling cron jobs run every minute.

I know this is an old thread, but I came across it looking for a solution for how to set up cron jobs on siteground for SuiteCRM.

Here is a working cron job:

/usr/local/php70/bin/php-cli -q /home/ACCOUNT_NAME/public_html/crm/cron.php

They do have a policy to set it for every 30 minutes. That should be fine.

Also, I had an issue where it said the user was not allowed to run the cron job… I found a great solution on easycron’s site:

If you get error: Uncaught exception ‘Exception’ with message 'cron.php running with user that is not in allowed_cron_users in config.php in your cron job execution logs, you need to do the following to fix it: 1) create a php file named “get_current_user.php” with the following code:

echo get_current_user();
  1. Upload this php file to your suiteCRM server. 3) Access this file (via URL http://yourdomain/get_current_user.php) from a web browser, copy the output of the it (e.g. xxzzyy), and add a line of below code:
1 => 'xxzzyy',
    'allowed_cron_users' => 
    array (
      0 => 'www-data',

in the “config.php” file in your suiteCRM installation (remember to replace “xxzzyy” with the real output of your get_current_user.php). So that that part of code would look like:

    'allowed_cron_users' => 
    array (
      0 => 'www-data',
      1 => 'xxzzyy',

Hope this saves someone some time if they run into this issue.

if (!is_windows()) {
require_once 'include/utils.php';
$cronUser = getRunningUser();
if ($cronUser == '') {
    $GLOBALS['log']->warning('cron.php: can\'t determine running user. No cron user checks will occur.');
} elseif (array_key_exists('cron', $sugar_config) && array_key_exists('allowed_cron_users', $sugar_config['cron'])) {
    if (!in_array($cronUser, $sugar_config['cron']['allowed_cron_users'])) {
        $GLOBALS['log']->fatal("cron.php: running as $cronUser is not allowed in allowed_cron_users ".
                               "in config.php. Exiting.");
        if ($cronUser == 'root') {
            // Additional advice so that people running as root aren't led to adding root as an allowed user:
            $GLOBALS['log']->fatal('cron.php: root\'s crontab should not be used for cron.php. ' .
                                   'Use your web server user\'s crontab instead.');
        sugar_die('cron.php running with user that is not in allowed_cron_users in config.php');
} else {
    $GLOBALS['log']->warning('cron.php: missing expected allowed_cron_users entry in config.php. ' .
                             'No cron user checks will occur.');


just add addCronAllowedUser($cronUser); this function write current username inside config.php

If you’re going to edit a file, why edit a code file instead of just adding a value manually in a config file?

so that code will dynamic for differ users.

I have this happening all the time in my suitecrm.log.

Sun Jun 28 21:30:02 2020 [2885906][-none-][FATAL] cron.php: can’t determine running user. No cron user checks will occur.

I have tried all of the above suggestions but none of them work. Is this really an issue or just a red herring?

Regards, Chris.

Are you really getting a fatal on this?

The code issues a WARNING:

That’s what it is, a warning. Not a red herring. It’s informing you that an important check won’t be done automatically for you. Of course, the fact that it isn’t checked does not mean that it would find an actual problem if it could check.

Bottom-line: make sure that the user name under which your cron jobs are running is the web server’s user name. Any other user is probably a wrong option, and if it is root then it is surely a wrong option.

Thank you for the reply… It is definately a fatal in the log file as above. But the cron job is running. Also, the username that it is running under is uk123, which I have added to the allowed cron users in the config.php file. I too have checked the cron.php file and as you have stated it should only be a warning with that text. So I have no idea where it is coming from.

4 posts were split to a new topic: Setting up cron jobs