release=nextcloud-23.0.12 date=$( date '+%m%d%Y_%I%M%p' ) systemctl stop apache2 cd /var/www wget https://download.nextcloud.com/server/releases/$release.zip #wget https://download.nextcloud.com/server/releases/latest.zip #wget https://download.nextcloud.com/server/releases/nextcloud-23.0.12.zip cp /var/www/html/config/config.php /var/www/config.php mv /var/www/html "/var/www/nextcloud-old-$date" unzip -q $release.zip; mv /var/www/nextcloud /var/www/html; mv $release.zip $release-$date.zip; mv /var/www/config.php /var/www/html/config/config.php chown -R www-data:www-data /var/www/html find /var/www/html/ -type d -exec chmod 750 {} \; find /var/www/html/ -type f -exec chmod 640 {} \; systemctl restart apache2 cd /var/www/html; usermod -s /bin/bash www-data su www-data -c "php occ upgrade" usermod -s /sbin/nologin www-data systemctl restart apache2