Project

General

Profile

Owncloud cli cheatsheet » History » Version 12

Jamila Khan, 09/04/2019 04:40 PM

1 1 Jessie Lee
{{lastupdated_at}} by {{lastupdated_by}}
2
3
{{>toc}}
4
5
h1. Owncloud cli cheatsheet
6
7
h2. Architecture 
8
9
* Owncloud by default is installed to /var/www/owncloud
10
* The apache conf file is in /etc/apache2/conf-available/owncloud.conf
11
** by default this redirects any http[s[://[url]/owncloud to the owncloud directory
12
** I often change this to redirect / to owncloud if on subdomain or office fileserver
13
* owncloud config file is in /var/www/owncloud/config/config.php
14
** note: if setting changes in the config file do not take, check the permissions for this file
15
* the owncloud directory also has a detailed .htaccess file that is vital to the security of owncloud
16
* The data directory can be found in the config file and is also the location of the owncloud.log file
17
** the data directory can and at office servers is often supplemented or replaced by local storage or SMB
18 2 Jessie Lee
* the backend database is mysql which is used by default for everything.
19
** some larger installs (ex. NDWA) use redis instead of mysql for file locking. 
20
* caching is performed by memcached or redis
21 3 Jessie Lee
22
h2. OCC
23
24
Occ is the cli command tool for owncloud. Through this tool most user/file/maintenance operations can be performed. 
25
detailed instructions can be found here https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/occ_command.html
26
27
key notes/favorite commands: 
28
29
* Occ must be run as the www-data user! 
30
** 8.0+ should no longer even allow running as root but if that happens there might be a permission mess to deal with!
31 6 Jessie Lee
** always use *sudo -u www-data php /var/www/owncloud/occ* (I have aliased this to occ)
32 4 Jessie Lee
* *occ upgrade* is needed for any major or minor release of owncloud!
33 3 Jessie Lee
** this will do a database upgrade test and then perform the upgrade
34
** for larger installs, this could take some time so only perform this during off hours. 
35 4 Jessie Lee
* *occ maintenance:mode --off/--on* this will gracefully close connections and turn on maintenance mode (or off)
36
* *occ file:scan [user]* this will rescan the file cache for [user] or --all for all
37 3 Jessie Lee
** this doesn't work for samba shares with OC login credentials as OC has no easy capacity for caching credentials for this purpose. (currently being worked on)
38 5 Jessie Lee
* *occ user:resetpassword [user]* will allow resetting a user password
39
* *occ user:lastseen [user]* will show when the user last logged in
40
* *occ user:report* will show a report of how many users are in the system
41 7 Jessie Lee
42 8 Janine Ko
h2. Command line upgade procedure 
43
44
* ssh into the server hosting the Owncloud instance 
45 9 Jamila Khan
* go to /var/www/owncloud/updater or /var/www/nextcloud/updater
46 8 Janine Ko
* run this command 
47
<pre> sudo -u www-data php updater.phar </pre>
48 1 Jessie Lee
* wait a little bit! if it happens too fast, it didn't update. 
49 8 Janine Ko
* In the web console, go to Overview > Settings to see if it updated. For example: https://cloud.rainforestfoundation.org/owncloud/index.php/settings/admin/overview
50 11 Janine Ko
* Refer to "documentation":https://docs.nextcloud.com/server/16/admin_manual/maintenance/update.html#using-the-command-line-based-updater if needed.
51 8 Janine Ko
52 10 Jamila Khan
h2. Docker upgrade procedure
53
54
* using a docker-compose setup
55
* go to /opt/nextcloud-docker
56
* @sudo docker-compose pull && sudo docker-compose build@
57
* if those two things work correctly, run @docker-compose up -d@
58 12 Jamila Khan
* then @sudo docker-compose exec --user www-data app php occ maintenance:mode --off@
59
60 8 Janine Ko
h2. Old Upgrade Procedure
61 1 Jessie Lee
62 8 Janine Ko
* upgrade package via apt-get 
63 7 Jessie Lee
* run @sudo -u www-data php /var/www/owncloud/occ upgrade@
64
** upgrade may take a long time
65 9 Jamila Khan
* after completing run @sudo -u www-data php /var/www/owncloud/occ maintenance:mode --off@
Go to top