Docker: How to run cron.php to update feed for news app?

Created on 20 Apr 2019  路  4Comments  路  Source: nextcloud/docker

I was trying to use cron.php (located in /usr/src/nextcloud if I'm not mistaken) from inside the host with the command docker run nextcloud:apache php /usr/src/nextcloud/cron.php. This does not give me any errors, but also does not seem to do anything (feeds are not updated). The end goal is to have cron on my host system run the docker run command regularly to update the feeds. What am I doing wrong? Please ask me for any more information you need, not quite experienced enough to know where relevant logs would be.

Most helpful comment

I figured out how to fix my issue. The command I was looking for was:

docker exec -u www-data nextcloud_app_1 php -f /var/www/html/cron.php

I ran this command manually and it updated my news feeds. I then set up a cron job on my host system to run this command every 15 minutes.

All 4 comments

{"reqId":"eilPtPGZ9FLyFBYbOn7O","level":3,"time":"2019-04-20T03:16:45+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":{"Exception":"Exception","Message":"Not installed","Code":0,"Trace":[{"file":"\/usr\/src\/nextcloud\/lib\/base.php","line":660,"function":"checkInstalled","class":"OC","type":"::","args":[]},{"file":"\/usr\/src\/nextcloud\/lib\/base.php","line":1068,"function":"init","class":"OC","type":"::","args":[]},{"file":"\/usr\/src\/nextcloud\/cron.php","line":41,"args":["\/usr\/src\/nextcloud\/lib\/base.php"],"function":"require_once"}],"File":"\/usr\/src\/nextcloud\/lib\/base.php","Line":277,"CustomMessage":"--"},"userAgent":"--","version":""}

I found this data/nextcloud.log, interestingly, it only appeared after I entered the container with docker run <image> bash and ran cron.php that way. This is a bit hard for me to parse but based on the stack trace and the contents of cron.php it almost looks like it doesn't register nextcloud as being installed? A bit odd considering I can open up my server in a web browser no problem. Or does it mean something else is not installed?

I figured out how to fix my issue. The command I was looking for was:

docker exec -u www-data nextcloud_app_1 php -f /var/www/html/cron.php

I ran this command manually and it updated my news feeds. I then set up a cron job on my host system to run this command every 15 minutes.

I will update with whether or not the cron job worked, just in case anyone is having similar issues.

Yep that ended up being the solution.

Was this page helpful?
0 / 5 - 0 ratings