LoginSignup
12
15

More than 1 year has passed since last update.

ownCloud 管理者用 occ コマンドについて

Last updated at Posted at 2015-12-20

この記事は、ownCloud Advent Calendar 2015 12/16日の記事です。
ownCloud Japan Advent Calendar 2015 - Qiita
http://qiita.com/advent-calendar/2015/owncloud

あまり知られてないように思いますが、ownCloudの管理者向けコマンド occ はVer.8からいろいろ使えるようになってきました。

1. occコマンド

1.実行方法

まず、動かしかたですが、occ コマンドのある場所まで移動しましょう。

shell
# cd /var/www/html/owncloud

次にWebサーバーの権限でoccコマンドを実行しましょう。

shell
# sudo -u nginx ./occ

もし、Webサーバーが Apache(CentOS等) の場合は、以下のようにするとよいでしょう。

shell(CentOS等)
# sudo -u apache ./occ

2. コマンドオプション

実行すると以下のようなメッセージが出ると思います。(出ない場合はコマンド実行ユーザーが間違っていると思います)

shell
ownCloud version 8.2.1

Usage:
 [options] command [arguments]

Options:
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question

オプションは見ての通りですね。
--ansiは、実行結果に色が付きます(デフォルト)。--no-ansi で色が出力されません。
バッチなどで実行するときには--no-ansiをつけた方がいいでしょう。

3. occコマンド解説

occで使えるコマンドには2レベルあります。
1つめは、ownCloudそのものに対するコマンド(以下)

Available commands:
 check                                check dependencies of the server environment
 help                                 Displays help for a command
 list                                 Lists commands
 status                               show some status information
 upgrade                              run upgrade routines after installation of a new release. The release has to be installed before.

もう一つは、ownCloudで動いているアプリに対するコマンドです。(以下概要のみ抜粋)

app
background
config
db
encryption
files
l10n
log
maintenance
trashbin
user
versions

4. ownCloudに対するコマンド

コマンド名 説明
check システム上の依存関係をチェックします。
help ヘルプを表示
list helpと同じ
status ownCloudのVersion等を表示
upgrade ownCloudをアップグレードします(ソースコードがすでに設置されていること)

5. ownCloudのアプリに対するコマンド

コマンド名 説明
app アプリケーション(プラグイン)をリストアップしたり、有効化/無効化することができる(サブコマンド有り)
background バックグラウンドジョブの実行トリガーを変更できる(サブコマンド有り)
config 設定の取得/投入/表示が可能(サブコマンド有り)
db データベースの変換ができる
encryption 暗号関連の操作コマンド(サブコマンド有り)
files 外部ストレージ側のファイルの更新チェックとDBのファイルエントリーと実ファイルの不整合を直します。
l10n アプリのローカライゼーションの為のコマンド
log ログに関する設定変更、ログレベルの変更、タイムゾーンの変更
maintenance メンテナンスモードに関する設定変更ができる
trashbin ゴミ箱の操作(ユーザー毎に指定可能)
user ユーザーの追加/削除
versions 履歴ファイルの削除(ユーザー毎に指定可能)

6. occ コマンド オプション全体

shell
[owncloud]$ sudo -u nginx ./occ
ownCloud version 8.2.1

Usage:
 [options] command [arguments]

Options:
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question

Available commands:
 check                                check dependencies of the server environment
 help                                 Displays help for a command
 list                                 Lists commands
 status                               show some status information
 upgrade                              run upgrade routines after installation of a new release. The release has to be installed before.
app
 app:check-code                       check code to be compliant
 app:disable                          disable an app
 app:enable                           enable an app
 app:list                             List all available apps
background
 background:ajax                      Use ajax to run background jobs
 background:cron                      Use cron to run background jobs
 background:webcron                   Use webcron to run background jobs
config
 config:app:delete                    Delete an app config value
 config:app:get                       Get an app config value
 config:app:set                       Set an app config value
 config:import                        Import a list of configs
 config:list                          List all configs
 config:system:delete                 Delete a system config value
 config:system:get                    Get a system config value
 config:system:set                    Set a system config value
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
encryption
 encryption:change-key-storage-root   Change key storage root
 encryption:decrypt-all               Disable server-side encryption and decrypt all files
 encryption:disable                   Disable encryption
 encryption:enable                    Enable encryption
 encryption:enable-master-key         Enable the master key. Only available for fresh installations with no existing encrypted data! There is also no way to disable it again.
 encryption:encrypt-all               Encrypt all files for all users
 encryption:list-modules              List all available encryption modules
 encryption:migrate                   initial migration to encryption 2.0
 encryption:set-default-module        Set the encryption default module
 encryption:show-key-storage-root     Show current key storage root
 encryption:status                    Lists the current status of encryption
files
 files:cleanup                        cleanup filecache
 files:scan                           rescan filesystem
l10n
 l10n:createjs                        Create javascript translation files for a given app
log
 log:manage                           manage logging configuration
 log:owncloud                         manipulate ownCloud logging backend
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
trashbin
 trashbin:cleanup                     Remove deleted files
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
versions
 versions:cleanup                     Delete versions
12
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
15