scan files on owncloud (occ Command)

Status
Not open for further replies.

okaenrique

Dabbler
Joined
Jul 22, 2015
Messages
48
Hello!

i need help to scan file on owncloud with occ Command

i test it with but is not work
sudo -u www php occ files:scan path



root@owncloud_1:/usr/local/www/owncloud # sudo -u www php occ files:scan oka
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20100525/zlib.so' - Cannot open "/usr/local/lib/php/20100525/zlib.so" in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20100525/zlib.so' - Cannot open "/usr/local/lib/php/20100525/zlib.so" in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20100525/zlib.so' - Cannot open "/usr/local/lib/php/20100525/zlib.so" in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20100525/zlib.so' - Cannot open "/usr/local/lib/php/20100525/zlib.so" in Unknown on line 0
PHP Warning: Module 'session' already loaded in Unknown on line 0

Warning: Module 'session' already loaded in Unknown on line 0
An unhandled exception has been thrown:
OC\HintException: [0]: Missing memcache class \OC\Memcache\APCu for local cache (Is the matching PHP module installed and enabled ?)
root@owncloud_1:/usr/local/www/owncloud #
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
did you install sudo and php to the jail yourself?
You should be calling the instance of PHP that is installed with the plugin (PBI).

this is what I would do
Code:
chsh -s /bin/sh www
su www
cd /usr/pbi/owncloud-amd64/www/owncloud
/usr/pbi/owncloud-amd64/bin/php ./occ files:scan
 

okaenrique

Dabbler
Joined
Jul 22, 2015
Messages
48
did you install sudo and php to the jail yourself?
You should be calling the instance of PHP that is installed with the plugin (PBI).

this is what I would do
Code:
chsh -s /bin/sh www
su www
cd /usr/pbi/owncloud-amd64/www/owncloud
/usr/pbi/owncloud-amd64/bin/php ./occ files:scan



Thanks it is work :)
 

Bryan Scot

Cadet
Joined
Nov 28, 2016
Messages
3
Can someone please help me? I can get around in Linux/FreeBSD fairly well. I wouldn't consider myself a newbie, but I am still learning things. Having said that:

I have been able to use the commands above to scan for files in my Nextcloud jail running in FreeNAS.

I am trying to accomplish automating the scan.

I understand that I need to add the ./occ files:scan --all command to cron.php which is already added to crontab for the www user in the jail.

The issue is that, although I have programming experience, I have not coded in PHP and I am unsure how to add the lines necessary to autoscan files to the cron.php file.

I also understand that it may be a better idea to write the code in my own file and link to it in the cron.php file. There again i am unsure of the syntax and commands required to do this.

Thank you in advance for any help!

P.S. I would appreciate a straight forward answer/solution. I have already consulted the Nextcloud admin guide which is vague. I feel like I have done my due diligence, but am coming up short on information.
 
Last edited:

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
@Bryan Scot
based on your post I assume you are running the nextcloud plugin. you shouldn't be editing cron.php because nextcloud does file verification. you should instead add another cronjob for the www user. this likely needs to be readded anytime you update using FreeNAS's plugin update system.

crontab -u www -e
Code:
/usr/pbi/nextcloud-amd64/bin/php -f /usr/pbi/nextcloud-amd64/www/nextcloud/occ files:scan --all


why do you need to scan your files all the time? any directories that are changing not through nextcloud's code should be added using the "external storage support" app. there you can specify how often nextcloud scans for changes.
 

Bryan Scot

Cadet
Joined
Nov 28, 2016
Messages
3
Thank you so much for your reply.

I chose to integrate my FreeNAS volumes directly into the Nextcloud file structure rather than mount them as external storage. Why I chose to do this?, I don't really have a good reason. Mainly because when I launch Nextcloud, I wanted to see the files directly rather than having to click on "External Storage". Also, I felt like the integration of the users/groups would work better if I integrated it into the jails file system. My thoughts may be flawed; that just the decision I made.

The users' storage volumes that are mounted in Nextcloud are also Windows Shares. I want to be able to manage those volumes, i.e. add and delete files in Windows, and to have those changes show up in Nextcloud. This is why i wanted to scan the files periodically, so that Nextcloud would see the changes. Again, it may not be the most correct method or procedure. But I am experimenting and learning!

1. So if I am to proceed with this route, then do I create a new "cron.php" file labeled whatever I want it to be, i.e. "mycron.php" and simply insert the command line given in the previous post?
2. Is there any other syntax or code needed in the file?
3. Where do I store the file?

Thanks again for your support!
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
@Bryan Scot
I don't advise you do it that way. nextcloud's data-directories (/media) contain files that should not be modified except by nextcloud. Only a section of these are your users actual files. Anything changed by other programs like CIFS should be addressed as an External Storage location. One limitiation though, is I don't think you can currently mount your users top directory as an external mount point. I know you could do this in past version of owncloud, not 100% sure if this can still be done.

I thought I made myself clear earlier, if you want to continue the method I advise against you do not need to modify / write your own cron.php. You just need to add a second job for cron to run.
If you run "crontab -u www -e" you will be editing the 'www' user's crontab. You can add whatever jobs you want, at any interval you want. The command I linked earlier is the command you need to run.
 
Status
Not open for further replies.
Top