ownCloud - occ command

 

 


occ command

 

建立 shotcut

ln -s /INSTALL_PATH/owncloud/occ /usr/sbin/occ

Usage

# 要用 www-data User 來行

occ

Console has to be executed with the user that owns the file config/config.php
Current user: root
Owner of config.php: apache

# 所以要這樣執行

sudo -u www-data occ

version

sudo -u apache ./occ -V

ownCloud 10.13.2

test

sudo -u www-data occ status

  - installed: true
  - version: 8.2.2.2
  - versionstring: 8.2.2
  - edition:

help

sudo -u www-data occ help app:list

maintenance

maintenance
maintenance:mimetype:update-db   # Update database mimetypes and update filecache
maintenance:mimetype:update-js    # Update mimetypelist.js
maintenance:mode                          # set maintenance mode
maintenance:repair                         # repair this installation
maintenance:singleuser                   #set single user mode

i.e.

sudo -u www-data occ help maintenance:mode --on

Options:

 --on                  enable maintenance mode
 --off                  disable maintenance mode

background jobs type

background:ajax                      Use ajax to run background jobs

background:cron                      Use cron to run background jobs

background:webcron                Use webcron to run background jobs

db

db:convert-type                      Convert the ownCloud database to the newly configured one

db:generate-change-script            generates the change script from the current connected db to db_structure.xml

user

user:add                            # adds a user

user:delete                         # deletes the specified user

user:lastseen                      # shows when the user was logged it last time

user:report                         # shows how many users have access

user:resetpassword            # Resets the password of the named user

i.e.

# reset admin password

sudo -u apache occ user:resetpassword admin

Enter a new password:
Confirm the new password:
Successfully reset password for admin

# list app

sudo -u apache occ app:list

# output

Enabled:
.....
Disabled:
.....

# enable an app

sudo -u apache occ app:enable passwordpolicy

File 相關

files:scan

# command scans for new files and updates the file cache.

files:scan <--all | USER>

i.e.

sudo -u apache occ files:scan tim

Starting scan for user 1 out of 1 (tim)

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 3       | 0     | 00:00:00     |
+---------+-------+--------------+

files:checksums:verify

# Get all checksums in filecache and compares them by recalculating the checksum of the file.

occ files:checksums:verify [-u USER-u]        #  不帶參數 = for all users

i.e.

Mismatch for files/welcome.txt:
 Filecache:   SHA1:...
 Actual:  SHA1:...

versions

versions:expire

# versions_retention_obligation setting in config.php

sudo -u www-data ./occ versions:expire [<user_id>]

versions:cleanup

# to delete file ALL versions

sudo -u www-data ./occ versions:cleanup [<user_id>]

Check App

integrity:check-core                # Check core integrity using a signature.

integrity:check-app                 # Check app integrity using a signature.

 

 

 

 

 

Creative Commons license icon Creative Commons license icon