My database seems inconsitent, files present on sftp are not synchronized and missing in the web-interface. I probably should start a rescan (occ command) in the cli.
But …
I use Onwcloud 10.0.0.9 on a shared server (infomaniak.com)
I do not have access to ssh or command line.
I can use sftp and mysqladmin.
There is also a cron service enabling me to run cron.php in regular intervals.
Is there a way to trigger a file scan to get the database consistent with the existing files?
Hi Tom
Thank you for your interest. My hoster offers a kind of webcron, allowing to launch php-sides with a command like “www.mysite.xy/owncloud/cron.php”. He probably blocks attempt to use cli-commands. I have tried, but I could not figure out a syntax working with “occ” instead of “cron.php”. To my knowledge, “occ” itself launches the command “console.php”. But again, I could not figure out a syntax to trigger the desiered function “files:scan --all”
Thank you Fabio
maybe its possible to somehow call external commands like occ from a php file which is in turn called by the webcron?
But from your description it looks like you’re using ownCloud in a more advanced way, maybe switching to an hosting plan which gives you more control via SSH might be another alternative?
There exists a file:
owncloud/apps/files/lib/BackgroundJob/ScanFiles.php
What is probably more or less what I need, but it primarilly exports a class ScanFiles.
So it seems possible to generate a background job (re-)scanning files, but… how to trigger it?
Thanks - Fabio
Finally, after having installed a reliable cron-service, the database repaired itself.
Nevertheless, it is regretable that the administrator can not launch a complet database rescan from the administration console.
Fabio
Hi Alfred
The cronjob just starts the cron.php every 15 min. scan.php is a backgroudjob that ist launched by corn.php by default. It does not scan the entire filesystem at once (may be due to script execution time limits), but after hours and days everithing should be scanned if the users aren’t to busy…
The (web)cronjob is launched by my hoster, who offers the possibility to set up this kind of function.
This may also be done by an external webcron service (see documentation).
Fabio
Hi I found this thread because I’m experiencing the same problem.
And since I am also on shared hosting at Infomaniak I would really like to know how exactly how you @fabio solved it. Was it with cron.php? Did you eventually find the right syntax?
Thanks in advance!
Yes I’m on 10.5. Sorry but I don’t understand your answer. Where can I write that input, and then how can I specify what commands cron should run? …sorry if I sound trivial but I’m not that knowledgeable!
I’ll try to explain with more details what it looks like from my point of view:
Infomaniak -my web hosting provider- offers to run scheduled jobs by calling files on the server. I can’t simply shedule the command itself, it has to be in a file. Which I assumed would be fine with a ‘cron.php’ file that can be called regularly by the server.
That part works fine, but just like @fabio was experiencing, I’m not able to find a correct syntax to run occ files:scan command.
In the meantime I ran it manually by CLI. It did scan and update the dropbox folders, but since it took 30 minutes I guess it would be best to be able to specify the dropbox folder to be scanned instead of my whole owncloud directory.
If you have to contact your providers support team to install the cron job anyway, you could try the following:
find out where PHP is by running in a shell command -v php, if you can’t do that, the support team should know.
You should know where you installed your ownCloud, so you should know the path to your occ file in the ownCloud web root
get in touch with support telling them to run the cron job /path/to/php -f /path/to/occ system:cron with correctly filled out paths as the user the website is being executed as.
What are you actually trying to achieve? And what is not working?
I would like a cron job to periodically rescan my linked dropbox directory because the sync does not work automatically. Since this was the topic raised in this thread I simply followed up.
I managed to run the following shell command php occ system:cron -p and it seems to work fine, even though I suspect it only does part of the job each time it is called (that’s what @fabio pointed out). But I actually don’t quite get what it does. Output is different each time I run it. Or maybe it is running in the background and simply shows where it is at.
If I summarize:
I can manually rescan (only the dropbox directory) with shell command $ php occ files:scan --path="/jeremie/files/DropboxJS" (very slow, 1 file/sec but I see this is an issue on files_external_dropbox’s github page)
I can manually run $ php occ system:cron
My provider has a simple interface to setup cron jobs that can only run files (crontab not allowed)
So now I’m left with these questions:
How to write a php file that would simply run either occ system:cron or directly occ files:scan ...
How/where can one edit what system:cron does?
And last but not least: Is there a better way to keep dropbox-linked directories synced in OC?
You can’t. They’re provided by the apps. As said, there are some occ commands to manipulate the background queue, but that’s only what you get.
Note that, these days, the recommendation is to use occ commands and use cron / crontab (or any cron-like service) to run specific occ commands accordingly to your own schedule.
Maybe you should check with your provider because noone will know better how to do what you want other than him.
Without knowing anything about your provider, if they require you to use a php script for this, I’d be worried about that script to be in a public place and accessible to anyone, but I guess that’s their problem.
Normally, the cron-like services can run any executable, so you could create a simple shell script to run that command.