Last active
April 3, 2022 14:09
-
-
Save alainwolf/480d1b50b49f3e84fb021c793023d8b8 to your computer and use it in GitHub Desktop.
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 ash | |
# shellcheck shell=dash | |
# | |
# Nextcloud command-line upgrades for Synology DiskStation system environments. | |
# See https://docs.nextcloud.com/server/stable/admin_manual/maintenance/update.html#using-the-command-line-based-updater | |
# | |
# Its recommended to disable Nextcloud cron jobs beforehand manuallly | |
# synoschedtask --get owner=root type=daily state=enabled | |
# -------------------------------------------------- | |
# Configuration Settings | |
# -------------------------------------------------- | |
# Installed Nextcloud instance | |
_NEXTCLOUD_INSTALL_DIR="/var/services/web/nextcloud" | |
# Ensure PHP version of web-server matches | |
_PHP_CLI="/usr/local/bin/php74" | |
# Customized php-ini file. | |
_PHP_INI="/volume1/homes/admin/bin/occ.d/php-cli.ini" | |
# System user running the web-server | |
_NEXTCLOUD_OWNER="http" | |
# Recomended PHP.INI options | |
_PHP_OPTIONS=" | |
memory_limit=-1 | |
extension_dir=/volume1/@appstore/PHP7.4/usr/local/lib/php74/modules | |
zend_extension=opcache.so | |
extension=apcu.so | |
extension=redis.so | |
apc.enabled=1 | |
apc.enable_cli=1 | |
opcache.enable=1 | |
opcache.enable_cli=1" | |
# -------------------------------------------------- | |
# End Of Settings | |
# -------------------------------------------------- | |
# Abort on any error on unset variable | |
set -e -u | |
#_php_cmd_opts="-c $_PHP_INI" | |
_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 ./updater/updater.phar | |
# shellcheck disable=SC2086 | |
sudo -u "$_NEXTCLOUD_OWNER" \ | |
"$_PHP_CLI" $_php_cmd_opts -f ./occ -- "upgrade" | |
# shellcheck disable=SC2086 | |
sudo -u "$_NEXTCLOUD_OWNER" \ | |
"$_PHP_CLI" $_php_cmd_opts -f ./occ -- "db:add-missing-indices" | |
# shellcheck disable=SC2086 | |
sudo -u "$_NEXTCLOUD_OWNER" \ | |
"$_PHP_CLI" $_php_cmd_opts -f ./occ -- "db:add-missing-columns" | |
# shellcheck disable=SC2086 | |
sudo -u "$_NEXTCLOUD_OWNER" \ | |
"$_PHP_CLI" $_php_cmd_opts -f ./occ -- "db:add-missing-primary-keys" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment