Merge pull request #9583 from leegarrett/master

Document `occ status` and `-e` option (Related to #35873)
This commit is contained in:
Daniel
2023-08-07 20:30:53 +02:00
committed by GitHub
2 changed files with 67 additions and 0 deletions

View File

@@ -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.

View File

@@ -1130,6 +1130,70 @@ Remove a certificate::
sudo -u www-data php occ security:certificates:remove [certificate name]
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
}
Status return code
^^^^^^^^^^^^^^^^^^
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_label:
Trashbin