Question - why is cron working but not running automatically?

Hi,

Our risk and compliance function has requested to evaluate Eramba so I’ve set it up on our servers. Can’t get cron to work though.

I have wandered across all topics on this forum related to cron not working, but have been unable to figure out what my specific issue is and how it should be resolved.

Specifically, what I have tried so far is using the chown voodoo on the cron.log file, taken down the docker containers and started them again. I have also made sure the public address is the same as I’m accessing the service from.

I can get cron to work if I enter into the cron-container and run su -s /bin/bash -c "/var/www/eramba/app/upgrade/bin/cake cron job daily --skip-validation" www-data. It also works to run the hourly task. The cron jobs, however, are not running automatically. Further, there is nothing in the cron.log` (even after running the tasks manually). Also, there are no failed cron jobs on the settings / cron-page.

After running the cron jobs manually, the health check turns fully green. Before running manually, I get an error on the cron worker item.

I’m not sure where to go from here, any help would be appreciated.

Hello,

What does the host machine look like? what is the host OS? Any changes made to the default config?
Try to check sys logs and also /var/mail/{user} have some cron messages.
The worker is a cron that is started every minute so you should be able to see some error from the system every minute.

1 Like

Hi,

The host is an EC2 instance running Amazon Linux 2023. There is disk space, CPU capacity and RAM capacity left to handle these tasks (they do run without a hassle when triggered manually). There are no significant changes in the base config that I would expect this to be affected by.

When you refer to the sys logs and /var/mail/(user), do you mean on the host or in the cron-container?

Does the public adress affect any internal functionality, as suggested by the error message when running the health check from CLI?

Cron container. I’m not sure which health check you are referring to, but yes, the public address has to be setup correctly, it may affect crons as well.

1 Like

Oh, there was indeed some interesting information in /var/mail/www-data in the container: /bin/sh: 1: export: #: bad variable name. I had added a line with a comment in the .env-file. When I removed that line and restarted the docker container there are more processes running in when I do a ps aux:

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.0   3600  1976 ?        Ss   May27   0:01 cron -f
root       17196  0.0  0.0   4188  3476 pts/0    Ss   06:54   0:00 /bin/bash
root       19462  0.0  0.0   4060  2056 ?        S    11:47   0:00 CRON -f
www-data   19463  0.0  0.0   2576   928 ?        Ss   11:47   0:00 /bin/sh -c export $(cat /var/www/docker.env) && /bin/sh /var/www/eramba/app/upgrade/bin/cake queue run -v >> /
www-data   19465  0.3  0.5 106420 46976 ?        S    11:47   0:00 /usr/local/bin/php /var/www/eramba/app/upgrade/bin/cake.php queue run -v
root       19483  0.0  0.0   4060  2056 ?        S    11:48   0:00 CRON -f
www-data   19484  0.0  0.0   2576   904 ?        Ss   11:48   0:00 /bin/sh -c export $(cat /var/www/docker.env) && /bin/sh /var/www/eramba/app/upgrade/bin/cake queue run -v >> /
www-data   19486  0.4  0.5 106420 47000 ?        S    11:48   0:00 /usr/local/bin/php /var/www/eramba/app/upgrade/bin/cake.php queue run -v
root       19547  0.0  0.0   8088  3876 pts/0    R+   11:49   0:00 ps aux

I also see a lot of this in the cron.log:

---------------------------------------------------------------
[2024-05-29 13:51:53] Looking for Job ...
nothing to do, sleeping.
Entity save failure. Found the following errors (server.validateCount: "Too many workers running. Check your `Queue.maxworkers` config.").
Cannot start worker: Too many workers already/still running on this server (2/2)
---------------------------------------------------------------
[2024-05-29 13:52:02] Looking for Job ...
nothing to do, sleeping.
---------------------------------------------------------------
[2024-05-29 13:52:03] Looking for Job ...
nothing to do, sleeping.
---------------------------------------------------------------
[2024-05-29 13:52:12] Looking for Job ...
nothing to do, sleeping.
---------------------------------------------------------------
[2024-05-29 13:52:13] Looking for Job ...
nothing to do, sleeping.
---------------------------------------------------------------
[2024-05-29 13:52:22] Looking for Job ...
nothing to do, sleeping.
---------------------------------------------------------------
[2024-05-29 13:52:23] Looking for Job ...
nothing to do, sleeping.

The system health page in the GUI is all green now and also:

root@8a6623be26c1:/var/log# su -s /bin/bash -c "/var/www/eramba/app/upgrade/bin/cake system_health check" www-data
All ok.

Me thinks that this is working as expected now. Thank you for pointing me in the right direction!

Cool! Yes, it happened to me before. .env file does not support comments. Lesson learned!
All should be ok now.

1 Like