Crontab command issue (Solved)

Hi everyone!

Today i found out that cron log had errors like these:

Jan  3 12:10:01 deepblue crond[782]: (cd) ERROR (getpwnam() failed)
Jan  3 12:11:01 deepblue crond[782]: (cd) ERROR (getpwnam() failed)

I searched the crontab file and realised that the issue was happening by the command that SuiteCRM asks you to add in the crontab.
In my case was this (you can find yours at Admin->Schedulers->bottom of page):

*    *    *    *    *     cd /var/www/html/SuiteCRM1; php -f cron.php > /dev/null 2>&1 

but i noticed that something is missing. The user is missing from the command!
So i changed the above command to:

*    *    *    *    *   apache  cd /var/www/html/SuiteCRM1; php -f cron.php > /dev/null 2>&1

I used the “apache” user because it has full access under the /var/www/html folder and also the Apache server runs under “apache” user.
My OS is Centos 7, if you are running different os you need to find your Apache user and change the above command accordingly
I avoided using root cause root could cause permission issues in SuiteCRM.
As a result this my current log:

Jan  3 12:34:01 deepblue CROND[35534]: (apache) CMD ( cd /var/www/html/SuiteCRM1; php -f cron.php > /dev/null 2>&1)
Jan  3 12:35:01 deepblue CROND[35559]: (apache) CMD ( cd /var/www/html/SuiteCRM1; php -f cron.php > /dev/null 2>&1)

Enjoy!

Some crons have that column for the user name, some don’t.

In Ubuntu, there’s something called the “system-wide crontab” that has a column for it, like in your system.

The alternative is to edit each individual user’s crontab (with sudo -e -u username).

The SuiteCRM installer instructions need to be improved.

The important thing to note is to not use root for the cron jobs (like you point out correctly in your post).