The script cron.php doesn’t execute itself … and I have no clue why because when I try to launch the task as www-data manually I don’t have any error message and the UI tells me that the task ran for the last time a few seconds ago.
I tried replacing php by php-cli, I also tried to add the path to PHP and chmod +x cron.php just in case, no change. Cron just don’t execute any task. AJAX works … but that’s all.
OS: Ubuntu 18.04.1 LTS
Docker-Compose: 1.23.2, build 1110ad0
Image: Nextcloud:latest (15.0.2) default install
perhaps /usr/bin/php would be better. (or where ever php is installed.) cron jobs don’t have normal env settings.
As I said, I tried adding the path and no change at all unfortunately.
so how do you run php cron.php ?
inside the container or using docker exec?
Inside the Docker actually. Do I have to use the host cron with docker exec ?
As I said, when I execute the command manually from inside the Docker it works.
Have you checked whether the time setting in the docker container is correct? It could be, that the crontab is not executing the job due to time inconsistency.
Whether you execute the cron command from within the container or via docker exec, it always uses the container crontab. You should never use the host crontab to do something in the docker container.
at least this works in the hosts crontab:
docker exec --user www-data nextcloud php -f cron.php > /dev/null 2>&1
I don’t understand why you shouldn’t execute a cron task from the host since you can put a docker-exec command.
The time is right, the same as the host as you can see in my docker-compose.yml file.
And since the task should execute itself in a 15 minutes interval, even if the time wasn’t right it should be OK since 15 minutes are always 15 minutes, no ?
Just to clarify, my last sentence regarding the “execution of cron tasks via the host towards the docker container” was unwell chosen.
To rectify my last sentence, yes you can use the host crontab with the
docker exec command (just like @Reiner_Nippes mentioned in his last post). In fact I thought about it a little more and tested it yesterday and would even agree, that this is the better solution.
@Xanarkan I mentioned the time as a possible cause because I had this on a clients machine once. They had a weird timezone setup and the date was always set in the past and their cron jobs were not running as well.
Try setting up a cron job with @Reiner_Nippes example on your host and monitor the
/var/log/syslog for cron entries and see, if it gives you any info/warning/error messages. As you said yourself, you can run the command from within the container (calling the cron.php) without any errors, so there must be something crontab is tripping over.
Ho, okey I understand better what you said.
Concerning the time, seems that’s the same within the docker and on the host.
Wed Jan 30 15:56:31 UTC 2019
mercredi 30 janvier 2019, 15:56:41 (UTC+0000)