Skip to content

Instantly share code, notes, and snippets.

@jult
Last active September 11, 2024 03:36
Show Gist options
  • Save jult/81483028fe60d59d6871d07fcaea94a8 to your computer and use it in GitHub Desktop.
Save jult/81483028fe60d59d6871d07fcaea94a8 to your computer and use it in GitHub Desktop.
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