nextcloud-logo-white-transparent
  • ★製品概要
    • なぜ、今、Nextcloudが必要か
    • Nextcloudで始めるセキュアなファイル共有
    • Nextcloudと他のオンラインストレージ製品の比較
  • 製品詳細
    • Nextcloudのアーキテクチャー
    • システム要件
    • バージョンアップ履歴
    • EOL一覧
    • Nextcloud API一覧
    • Nextcloudデスクトップクライアント
    • Nextcloudモバイルアプリ
  • ユースケース
    • ユースケース
      • 取引先との安全なファイル共有
      • 既存ファイルサーバーをそのまま活用
      • 営業マンのファイル持ち出しを安全に実現
      • 支店間など広域ネットワークでファイル共有したい
      • 教育・研究機関でのオンラインストレージ利用
      • 開発プラットフォームとしてのNextcloud
      • remote.itとの組み合わせによるセキュアなオンラインストレージ
    • 導入事例
      • Nextcloud導入事例(京都大学様) 請求フォーム
      • Nextcloud導入事例(明治大学様) 請求フォーム
  • お知らせ/テックブログ
    • ニュースリリース
    • セミナー
    • Nextcloud
    • ONLYOFFICE
  • サービス
    • 導入サービス、導入支援
    • サポートの概要
    • EnterpriseサポートとCommunityサポートの選び方
    • Enterpriseサポート
    • Communityサポート
    • Nextcloud保守サポートでサポートされるアプリケーション
  • お問い合わせ
    • Nextcloud導入のご相談、お見積り
    • 会社概要
    • Nextcloudカタログ等資料請求
    • ★ダウンロード資料一覧
  • ONLYOFFICE
    • ONLYOFFICEでOfficeファイルをオンライン活用(ONLYOFFICE公式パートナー)

【techblog】Nextcloudの管理用CLI「occ」詳細: Nextcloud自体に対するコマンド群、共通オプション設定

2019年2月18日NEXTNextcloud, techblog

はじめに

NextcloudにはCLI環境としてoccというものがあり、さまざまな設定、管理を行うことができます。 ここでは occ で使える様々なコマンド群のうち、Nextcloud自体に対するコマンド群と、あわせて各コマンド共通で使うことができるオプション設定についてまとめてみます。

※occ の使い方については、【techblog】 Nextcloudの管理用CLI「occ」コマンドについて の記事を参照ください。

環境について

ここで記載するoccを実行するNextcloudのバージョンは、2019年2月18日現在で最新の15.0.4を利用します。

Nextcloud自体に対するコマンド群

Nextcloud自体に対するコマンドには以下のようなものがあります。

  • help
  • list
  • status
  • check
  • upgrade

help

"help"コマンドは、コマンドに対するヘルプを表示します。

$ sudo -u nginx php /var/www/html/nextcloud/occ help
Usage:
  help [options] [--] [<command_name>]

Arguments:
  command               The command to execute
  command_name          The command name [default: "help"]

Options:
      --format=FORMAT   The output format (txt, xml, json, or md) [default: "txt"]
      --raw             To output raw command help
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --no-warnings     Skip global warnings, show command output only
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  The help command displays help for a given command:
  
    php /var/www/html/nextcloud/occ help list
  
  You can also output the help in other formats by using the --format option:
  
    php /var/www/html/nextcloud/occ help --format=xml list
  
  To display the list of available commands, please use the list command.

"--format"オプションを使うことによりさまざまなフォーマットで表示することができます。指定できるフォーマットは次のとおりです。

  • txt (テキスト形式: デフォルト)
  • xml (XML形式)
  • json (JSON形式)
  • md (Markdown形式)

"--raw"オプションを指定すると、加工されないコマンドのヘルプを出力します。

occ で使えるコマンドのリストを表示したい場合は"list"コマンドを使ってください。

■実行例① listコマンドのヘルプを表示

$ sudo -u nginx php /var/www/html/nextcloud/occ help list
Usage:
  list [options] [--] [<namespace>]

Arguments:
  namespace            The namespace name

Options:
      --raw            To output raw command list
      --format=FORMAT  The output format (txt, xml, json, or md) [default: "txt"]

Help:
  The list command lists all commands:
  
    php /var/www/html/nextcloud/occ list
  
  You can also display the commands for a specific namespace:
  
    php /var/www/html/nextcloud/occ list test
  
  You can also output the information in other formats by using the --format option:
  
    php /var/www/html/nextcloud/occ list --format=xml
  
  It's also possible to get raw list of commands (useful for embedding command runner):
  
    php /var/www/html/nextcloud/occ list --raw

■実行例② XML形式でlistコマンドのヘルプを表示

$ sudo -u nginx php /var/www/html/nextcloud/occ help --format=xml list
<?xml version="1.0" encoding="UTF-8"?>
<command id="list" name="list" hidden="0">
<usages>
<usage>list [--raw] [--format FORMAT] [--] [&lt;namespace&gt;]</usage>
</usages>
<description>Lists commands</description>
<help>The &lt;info&gt;list&lt;/info&gt; command lists all commands:

&lt;info&gt;php /var/www/html/nextcloud/occ list&lt;/info&gt;

You can also display the commands for a specific namespace:

&lt;info&gt;php /var/www/html/nextcloud/occ list test&lt;/info&gt;

You can also output the information in other formats by using the &lt;comment&gt;--format&lt;/comment&gt; option:

&lt;info&gt;php /var/www/html/nextcloud/occ list --format=xml&lt;/info&gt;

It's also possible to get raw list of commands (useful for embedding command runner):

&lt;info&gt;php /var/www/html/nextcloud/occ list --raw&lt;/info&gt;</help>
<arguments>
<argument name="namespace" is_required="0" is_array="0">
<description>The namespace name</description>
<defaults/>
</argument>
</arguments>
<options>
<option name="--raw" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output raw command list</description>
</option>
<option name="--format" shortcut="" accept_value="1" is_value_required="1" is_multiple="0">
<description>The output format (txt, xml, json, or md)</description>
<defaults>
<default>txt</default>
</defaults>
</option>
</options>
</command>

■実行例③ JSON形式でlistコマンドのヘルプを表示

$ sudo -u nginx php /var/www/html/nextcloud/occ help --format=json list
{"name":"list","usage":["list [--raw] [--format FORMAT] [--] []"],"description":"Lists commands","help":"The list<\/info> command lists all commands:\n\n  php \/var\/www\/html\/nextcloud\/occ list<\/info>\n\nYou can also display the commands for a specific namespace:\n\n  php \/var\/www\/html\/nextcloud\/occ list test<\/info>\n\nYou can also output the information in other formats by using the --format<\/comment> option:\n\n  php \/var\/www\/html\/nextcloud\/occ list --format=xml<\/info>\n\nIt's also possible to get raw list of commands (useful for embedding command runner):\n\n  php \/var\/www\/html\/nextcloud\/occ list --raw<\/info>","definition":{"arguments":{"namespace":{"name":"namespace","is_required":false,"is_array":false,"description":"The namespace name","default":null}},"options":{"raw":{"name":"--raw","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output raw command list","default":false},"format":{"name":"--format","shortcut":"","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"The output format (txt, xml, json, or md)","default":"txt"}}},"hidden":false}

■実行例④ Markdown形式でlistコマンドのヘルプを表示

$ sudo -u nginx php /var/www/html/nextcloud/occ help --format=md list
`list`
------

Lists commands

### Usage

* `list [--raw] [--format FORMAT] [--] [<namespace>]`

The list command lists all commands:

php /var/www/html/nextcloud/occ list

You can also display the commands for a specific namespace:

php /var/www/html/nextcloud/occ list test

You can also output the information in other formats by using the --format option:

php /var/www/html/nextcloud/occ list --format=xml

It's also possible to get raw list of commands (useful for embedding command runner):

php /var/www/html/nextcloud/occ list --raw

### Arguments

#### `namespace`

The namespace name

* Is required: no
* Is array: no
* Default: `NULL`

### Options

#### `--raw`

To output raw command list

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--format`

The output format (txt, xml, json, or md)

* Accept value: yes
* Is value required: yes
* Is multiple: no
* Default: `'txt'`

list

occ で利用できるコマンドの一覧が表示できます。

$ sudo -u apache php /var/www/html/nextcloud/occ list
Nextcloud 15.0.4

Usage:
  command [options] [arguments]

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

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.
 activity
  activity:send-mails                 Sends the activity notification mails
 app
  app:check-code                      check code to be compliant
  app:disable                         disable an app
  app:enable                          enable an app
  app:getpath                         Get an absolute path to the app directory
  app:install                         install an app
  app:list                            List all available apps
  app:remove                          remove an app
  app:update                          update an app or all 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
 dav
  dav:create-addressbook              Create a dav addressbook
  dav:create-calendar                 Create a dav calendar
  dav:remove-invalid-shares           Remove invalid dav shares
  dav:sync-birthday-calendar          Synchronizes the birthday calendar
  dav:sync-system-addressbook         Synchronizes users to the system addressbook
 db
  db:add-missing-indices              Add missing indices to the database tables
  db:convert-filecache-bigint         Convert the ID columns of the filecache to BigInt
  db:convert-mysql-charset            Convert charset of MySQL/MariaDB to use utf8mb4
  db:convert-type                     Convert the Nextcloud database to the newly configured one
 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:encrypt-all              Encrypt all files for all users
  encryption:list-modules             List all available encryption modules
  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
 federation
  federation:sync-addressbooks        Synchronizes addressbooks of all federated clouds
 files
  files:cleanup                       cleanup filecache
  files:scan                          rescan filesystem
  files:scan-app-data                 rescan the AppData folder
  files:transfer-ownership            All files and folders are moved to another user - shares are moved as well.
 group
  group:add                           Add a group
  group:adduser                       add a user to a group
  group:delete                        Remove a group
  group:list                          list configured groups
  group:removeuser                    remove a user from a group
 integrity
  integrity:check-app                 Check integrity of an app using a signature.
  integrity:check-core                Check integrity of core code using a signature.
  integrity:sign-app                  Signs an app using a private key.
  integrity:sign-core                 Sign core using a private key.
 l10n
  l10n:createjs                       Create javascript translation files for a given app
 log
  log:file                            manipulate logging backend
  log:manage                          manage logging configuration
 maintenance
  maintenance:data-fingerprint        update the systems data-fingerprint after a backup is restored
  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:theme:update            Apply custom theme changes
  maintenance:update:htaccess         Updates the .htaccess file
 migrations
  migrations:execute                  Execute a single migration version manually.
  migrations:generate                 
  migrations:generate-from-schema     
  migrations:migrate                  Execute a migration to a specified version or the latest available version.
  migrations:status                   View the status of a set of migrations.
 notification
  notification:generate               Generate a notification for the given user
 security
  security:certificates               list trusted certificates
  security:certificates:import        import trusted certificate
  security:certificates:remove        remove trusted certificate
 sharing
  sharing:cleanup-remote-storages     Cleanup shared storage entries that have no matching entry in the shares_external table
 trashbin
  trashbin:cleanup                    Remove deleted files
  trashbin:expire                     Expires the users trashbin
 twofactorauth
  twofactorauth:cleanup               Clean up the two-factor user-provider association of an uninstalled/removed provider
  twofactorauth:disable               Disable two-factor authentication for a user
  twofactorauth:enable                Enable two-factor authentication for a user
  twofactorauth:enforce               Enabled/disable enforced two-factor authentication
  twofactorauth:state                 Get the two-factor authentication (2FA) state of a user
 update
  update:check                        Check for server and app updates
 user
  user:add                            adds a user
  user:delete                         deletes the specified user
  user:disable                        disables the specified user
  user:enable                         enables the specified user
  user:info                           show user info
  user:lastseen                       shows when the user was logged in last time
  user:list                           list configured users
  user:report                         shows how many users have access
  user:resetpassword                  Resets the password of the named user
  user:setting                        Read and modify user settings
 versions
  versions:cleanup                    Delete versions
  versions:expire                     Expires the users file versions

特定のネームスペース(上記実行例の”activity”, “app”, ・・・)を指定することでこのネームスペースに属しているコマンドを表示することができます。

"--format"オプションを使うことによりさまざまなフォーマットで表示することができます。指定できるフォーマットは次のとおりです。

  • txt (テキスト形式: デフォルト)
  • xml (XML形式)
  • json (JSON形式)
  • md (Markdown形式)

"--raw"オプションを指定すると、加工されないコマンドのヘルプを出力します。

■実行例① ネームスペース”app”に属するコマンドの一覧を表示

$ sudo -u nginx php /var/www/html/nextcloud/occ list app
Nextcloud 15.0.4

Usage:
  command [options] [arguments]

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

Available commands for the "app" namespace:
  app:check-code  check code to be compliant
  app:disable     disable an app
  app:enable      enable an app
  app:getpath     Get an absolute path to the app directory
  app:install     install an app
  app:list        List all available apps
  app:remove      remove an app
  app:update      update an app or all apps

status

"status"コマンドは、Nextcloudのステータス情報を出力します。

$ sudo -u nginx php /var/www/html/nextcloud/occ status
  - installed: true
  - version: 15.0.4.0
  - versionstring: 15.0.4
  - edition:

"--output"オプションを利用すると出力フォーマットを指定することができます。指定できるフォーマットは次のとおりです。

  • plain (テキスト形式: デフォルト)
  • json (JSON形式)
  • json_pretty (整形されたJSON形式)

■実行例① 整形されたJSON形式でNextcloudのステータス情報を出力

$ sudo -u nginx php /var/www/html/nextcloud/occ status --output=json_pretty
{
    "installed": true,
    "version": "15.0.4.0",
    "versionstring": "15.0.4",
    "edition": ""
}

check

サーバー環境の依存関係を調べます。依存関係に問題がなければ何も出力はされません。

$ sudo -u apache php /var/www/html/nextcloud/occ check

"--output"オプションを利用すると出力フォーマットを指定することができます。指定できるフォーマットは次のとおりです。

  • plain (テキスト形式: デフォルト)
  • json (JSON形式)
  • json_pretty (整形されたJSON形式)

upgrade

新たにリリースされたNextcoudのバージョンアップグレードルーティンを実行します。リリースされたNextcloudアプリケーション群はあらかじめインストールしておくことが必要です。

$ sudo -u nginx php /var/www/html/nextcloud/occ upgrade
Nextcloud is already latest version

Nextcloudのアップグレードが完了している場合は上記のような表示となります。

Nextcloudをアップグレードすると以前のバージョンに戻すことはできませんので、実施する際は細心の注意をして実施をしてください。

コマンド共通で使用できるオプション群

occ の各コマンド共通で使用できるオプション群は次のとおりとなります。

-h, --help

コマンドに対するヘルプを表示します。

-q, --quiet

実行結果を何も表示しません。

-V, --version

このアプリケーションのバージョンを表示します。

--ansi

強制的にANSI出力(=色付きの表示)とします(デフォルト)。

--no-ansi

ANSI出力を無効にします。

-n, --no-interaction

対話型の質問(◯◯していいですか?(Y/N)的なもの)を行いません。

--no-warnings

全体的な警告を表示せずコマンド出力結果のみを表示します。

-v, --verbose / -vv / -vvv

より詳細なメッセージを表示します。

  • -v, –verbose: 通常出力(デフォルト)
  • -vv: より詳細な出力
  • -vvv: デバッグ出力

カテゴリー

  • Nextcloud Talkの紹介とOSS版Talk HBPのインストール2025年4月30日
  • Nextcloud Hub 10:2025年の最新統合ワークスペースを徹底解説!2025年3月31日
  • occコマンドの共通オプションについて2025年3月31日

Blog

  • 2025
  • 2024
  • 2023
  • 2022
  • 2021
  • 2020
  • 2019
  • 2018
  • 2016

ニュースリリース

  • 2025
  • 2024
  • 2023
  • 2022
  • 2021
  • 2020
  • 2019
  • 2017

Nextcloudのお問合せ

資料請求

Nextcloudの製品カタログの請求フォームです。

資料請求を行う

お問合せ・お見積り依頼

Nextcloudの導入をご検討の企業・団体の皆様。

お問合せフォームへ


-COMPANY-

〒101- 0052
東京都千代田区神田小川町1-2
風雲堂ビル6階


-PARTNER-

nextcloudamazon



 

-外部コンテンツ-

-Facebook-

Nextcloud広報室 – 株式会社スタイルズ

-Youtube-
Stylez Corp.

-Qiita-
Stylez Nextcloud


★製品概要製品詳細ユースケースお知らせ/テックブログサービスお問い合わせONLYOFFICE
© 2003 - 2023 Stylez Corp.