-
-
Save alainwolf/9facf318c2d21850142c691b2e16f5dd to your computer and use it in GitHub Desktop.
Nextcloud Command-Line Interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env sh | |
# shellcheck shell=dash | |
# | |
# Nextcloud Command-Line Interface | |
# | |
# See https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html | |
# | |
# -------------------------------------------------- | |
# Configuration Settings | |
# -------------------------------------------------- | |
# Installed Nextcloud instance | |
_NEXTCLOUD_INSTALL_DIR="/var/www/example.net/nextcloud" | |
# Ensure PHP version of web-server matches | |
_PHP_CLI="/usr/bin/php7.4" | |
# System user running the web-server | |
_NEXTCLOUD_OWNER="www-data" | |
# Recomended PHP.INI options | |
_PHP_OPTIONS=" | |
memory_limit=-1 | |
apc.enable_cli=1 | |
opcache.enable_cli=1" | |
# -------------------------------------------------- | |
# End Of Settings | |
# -------------------------------------------------- | |
# Abort on any error on unset variable | |
set -e -u | |
_php_cmd_opts="" | |
for _php_option in $_PHP_OPTIONS; do | |
_php_cmd_opts="$_php_cmd_opts --define $_php_option" | |
done | |
cd "$_NEXTCLOUD_INSTALL_DIR" || exit 1 | |
# shellcheck disable=SC2086 | |
sudo -u "$_NEXTCLOUD_OWNER" \ | |
"$_PHP_CLI" $_php_cmd_opts -f ./occ -- "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Convenient and safe command for sys-admins to manage your nextcloud instance from the command-line. without the need to remember or lookup all the caveats.