Skip to content

📃 This script features an automatic Backup & Update of your Nextcloud installation, using occ.

Notifications You must be signed in to change notification settings

PietsHost/nextcloud-Update-Script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 

Repository files navigation

Nextcloud Update-Script

GitHub issues GitHub release irc

This script features an automatic Backup & Update of your Nextcloud installation, using occ.

The script will check your installed version (e.g. 10.0.0) and the latest release-version (e.g. 10.0.2).
If an update is available, the script will backup the following folders: /data, /config, /themes, /apps
It also backups your current database - just in case, the upgrade goes wrong!

The script will check whether the backup was successful or not, and then it begins the update process by downloading the latest release.

If everything goes as expected, the script will use the occ upgrade command to upgrade your nextcloud installation. You will receive an email upon successful installation. If the upgrade process fails, your database will be restored

That's it! Visit your website and enjoy the latest version of Nextcloud!

original update script was found at the official Nextcloud VM by Tech and Me, maintened by:

Usage

Simply change lines 22 - 35 to suit your needs:

# Directories - change the following lines to suit your needs
html=/var/www/html		# root html directory
backup=$html/backup_`date +"%Y%m%d"`		# name of the backup folder, which will be created
ncpath=$html/nextcloud1	# name of subfolder in html directory, where your nextcloud installation is located
email="[email protected]"	# will be used for sending emails, if upgrade was successfull
htuser='apache'  		 # Webserver-User (CentOS: apache, suseLinux: wwwrun, etc..)
htgroup='apache' 		 # Webserver-Group (CentOS: apache, suseLinux: www, etc...)
name=nextcloud_install_1 # Define a name for your Instance, which will be upgraded

# Database Variables
dbserver=127.0.0.1		# Database host
database="databasename"	# Database name
user="databaseuser"		# Database username
pass="S€crEtP@s$"			# Database password

After that, set +x to the script and run it:

chmod +x ./ncupdate.sh
./ncupdate.sh

By default, the script will leave the folders "data", "config", "apps" and "themes" within your nextcloud path.
That's usefull for example if you have mass data and copying data to another folder would take too long..

You can enable a file backup (copy data files to another folder) by starting the script with "-b" option:
./ncupdate.sh -b
"-d" enables backup of external data directory, e.g. it's stored in /home/data:
./ncupdate.sh -bd /home/data

Notes

  • Tested on CentOS 6.8 & 7.3
  • Tested on openSUSE Leap 42.1

I'm sure it will work on every Linux System, even if I haven't tested it yet :)

Requirements

This script requires the following packages: bzip2 rsync pv php5-posix

  • CentOS / RHEL:
yum install -y bzip2 rsync pv php5-posix
  • openSUSE:
zypper in bzip2 rsync pv php5-posix

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

About

📃 This script features an automatic Backup & Update of your Nextcloud installation, using occ.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages