Skip to content

Instantly share code, notes, and snippets.

@jult

jult/nc_update.sh

Last active Feb 26, 2021
Embed
What would you like to do?
nextcloud update and post-update occ commands, file and database integrity fixes
#!/bin/bash
find /etc -type f -name "php.ini" -exec sed -i 's/output_buffering/;output_buffering/g' {} +
sudo -u www-data sed -i "s/output_buffering=.*/output_buffering='Off'/" /var/www/nextcloud/.user.ini
sudo -u www-data php /var/www/nextcloud/occ app:disable survey_client
sudo -u www-data php /var/www/nextcloud/occ app:disable firstrunwizard
sudo -u www-data php /var/www/nextcloud/occ app:enable admin_audit
sudo -u www-data php /var/www/nextcloud/occ app:enable files_pdfviewer
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
nohup chown -R www-data:www-data /var/www/nextcloud &
nohup find nextcloud/ -type d -exec chmod 750 {} \; &
nohup find nextcloud/ -type f -exec chmod 640 {} \; &
systemctl stop nginx
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off
sudo -u www-data php /var/www/nextcloud/occ upgrade
sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices
sudo -u www-data php /var/www/nextcloud/occ db:add-missing-primary-keys
sudo -u www-data php /var/www/nextcloud/occ db:convert-filecache-bigint
service mysql restart
service redis-server restart
systemctl restart php7.4-fpm nginx
nohup sudo -u www-data php /var/www/nextcloud/occ files:scan --all &
nohup sudo -u www-data php /var/www/nextcloud/occ files:scan-app-data &
sudo -u www-data php /var/www/nextcloud/occ update:check
sudo -u www-data php /var/www/nextcloud/occ app:update --all
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment