#!/bin/bash if test -f latest.tar.bz2; then rm latest.tar.bz2 #Removes incomplete or old downloads fi if [ -d "nextcloud.old" ]; then rm -r nextcloud.old #Removes old version of nextcloud fi sudo -u www-data php nextcloud/occ maintenance:mode --on wget https://download.nextcloud.com/server/releases/latest.tar.bz2 mv nextcloud nextcloud.old tar xf latest.tar.bz2 rm latest.tar.bz2 mv nextcloud.old/config/config.php nextcloud/config mv nextcloud.old/data nextcloud sudo chown www-data:www-data -R nextcloud sudo -u www-data php nextcloud/occ upgrade sudo -u www-data php nextcloud/occ maintenance:mode --off sudo -u www-data php nextcloud/occ db:add-missing-indices sudo -u www-data php nextcloud/occ maintenance:repair --include-expensive