mirror of
https://github.com/nextcloud/documentation.git
synced 2026-01-03 18:26:42 +07:00
Document occ status and -e option
Signed-off-by: Lee Garrett <lgarrett@rocketjump.eu>
This commit is contained in:
@@ -127,11 +127,14 @@ This approach requires two files: **nextcloudcron.service** and **nextcloudcron.
|
||||
|
||||
[Service]
|
||||
User=www-data
|
||||
ExecCondition=php -f /var/www/nextcloud/occ status -e
|
||||
ExecStart=/usr/bin/php -f /var/www/nextcloud/cron.php
|
||||
KillMode=process
|
||||
|
||||
Replace the user ``www-data`` with the user of your http server and ``/var/www/nextcloud/cron.php`` with the location of **cron.php** in your nextcloud directory.
|
||||
|
||||
The `ExecCondition` checks that the nextcloud instance is operating normally before running the background job, and skips it if otherwise.
|
||||
|
||||
The ``KillMode=process`` setting is necessary for external programs that are started by the cron job to keep running after the cron job has finished.
|
||||
|
||||
Note that the **.service** unit file does not need an ``[Install]`` section. Please check your setup because we recommended it in earlier versions of this admin manual.
|
||||
|
||||
@@ -1100,6 +1100,67 @@ Remove a certificate::
|
||||
|
||||
.. _trashbin_label:
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
Use the status command to retrieve information about the current installation::
|
||||
|
||||
$ sudo -u www-data php occ status
|
||||
- installed: true
|
||||
- version: 25.0.2.3
|
||||
- versionstring: 25.0.2
|
||||
- edition:
|
||||
- maintenance: false
|
||||
- needsDbUpgrade: false
|
||||
- productname: Nextcloud
|
||||
- extendedSupport: false
|
||||
|
||||
This information can also be formatted via JSON instead of plain text::
|
||||
|
||||
$ php occ status --output=json_pretty
|
||||
{
|
||||
"installed": true,
|
||||
"version": "25.0.2.3",
|
||||
"versionstring": "25.0.2",
|
||||
"edition": "",
|
||||
"maintenance": false,
|
||||
"needsDbUpgrade": false,
|
||||
"productname": "Nextcloud",
|
||||
"extendedSupport": false
|
||||
}
|
||||
|
||||
And finally, the ``-e`` (for exit code) parameter can be used to check
|
||||
the state of the nextcloud installation via return code::
|
||||
|
||||
$ php occ status -e
|
||||
$ echo $?
|
||||
0
|
||||
$ php occ maintenance:mode --on
|
||||
Maintenance mode enabled
|
||||
$ php occ status -e
|
||||
$ echo $?
|
||||
1
|
||||
$ php occ maintenance:mode --off
|
||||
Maintenance mode disabled
|
||||
$ php occ status -e
|
||||
$ echo $?
|
||||
0
|
||||
|
||||
Note that by default there is no output when run with ``-e``. This is
|
||||
intentional, so it can be used in scripts, monitoring checks, and systemd
|
||||
units.
|
||||
|
||||
+-------------+--------------------------------------------------------+
|
||||
| Return code | Description |
|
||||
+=============+========================================================+
|
||||
| 0 | normal operation |
|
||||
+-------------+--------------------------------------------------------+
|
||||
| 1 | maintenance mode is enabled; the instance is currently |
|
||||
| | unavailable to users. |
|
||||
+-------------+--------------------------------------------------------+
|
||||
| 2 | ``php occ upgrade`` is required |
|
||||
+-------------+--------------------------------------------------------+
|
||||
|
||||
Trashbin
|
||||
--------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user