Hello!
We been running two owncloud systems for for several years now and we used until this point cron jobs configured like this: /usr/local/bin/php -f /home/owncloud/public_html/cron.php
But that doesn’t seem to work anymore and we therefore followed the updated documentation and added: /usr/bin/php -f /home/owncloud/public_html/occ system:cron
But no success and the cron job does run.
We use c-panel to mange our VPS servers with…
We tested the variant command php -f /home/owncloud/public_html/occ system:cron to but to no avail.
We tried to use webcron too which isn’t working itseems unless you setup an external service…
Any idea on what could be wrong here? The old configuration worked prefectly for years but since it seems that owncloud has updated the ways of doing this it no longer works with that method. We are using owncloud version 10.3.2.2 community edition.
We do receive an error from the system which is: This script can be run from the command line only
(When using “/usr/bin/php -f /home/owncloud/public_html/occ system:cron”)
Thank you in advance for the assistance.
Kind regards
PowerQuest
Well we’re using the C-panel as mentioned before to mange our servers; the simple reason for this is that we chosen to outsource the day to day management/operations of our servers to a Danish hosting company that manage that for us so we can save time on not doing that part. So therefore we do not had sudo access/direct access to the server OS.
We can of course request that they execute anything for us. (E.g. the hosting company).
It´s is therefore of course (obviously) for that reason easier/well at at least faster for us just to enter the cron commands directly in the C-panel interface than using the commands that needs root access to the command shell/CMD.
So if i get this correctly there is no way other to do this from now on than through the CMD/shell?
cPanel is a typical shared hosting environment which is no longer supported by ownCloud. Specifically because of the case that sometimes it is absolutely required to run occ commands. This doesn’t necessarily require root access, but they need to be executed as the same user the web server runs.
This decision was made some time ago (I don’t know exactly it was before my time) and is probably pretty controversial especially in the community, where many people want to run ownCloud on hosting environments as cheap and efficient as possible.
As far as I know there is no other way for the cron jobs to execute.
Hello,
I’m running a a cPanel server too. I struggled with my cron not working as well. I tested a bunch of different command line options and this is the one that eventually worked consistently for me in cron for user running owncloud.
*/15 * * * * /usr/local/bin/php -f /path to owncloud public root/occ system:cron
Hope that is helpful.
Also found this important too, “The crontab requires full path of the command. The path system variable is not used in crontab.”
Well I found a way to get around the problem and running webcron instead with https://cron-job.org which is a service I found and it works great. Free too which is amazing…
However one of the two instances we are running of owncloud works great calling the /cron.php, but the other one is throwing off a 302 error for some unknown reason which I cannot figure out why:
Well I figured out a way to get that to work too.
instead of calling https://mydomain.com/cron.php I used https://mydomain.com/index.php/cron which does the trick. Not sure why the 302 is generated when calling /cron.php directly on that instance while the other one is working perfectly though.