Skip to content

Instantly share code, notes, and snippets.

@Belval
Last active November 13, 2018 21:58
Show Gist options
  • Save Belval/8a1d87591be50ff2666c550aff58b908 to your computer and use it in GitHub Desktop.
Save Belval/8a1d87591be50ff2666c550aff58b908 to your computer and use it in GitHub Desktop.
Script to backup Nextcloud install on Ubuntu
# We aim to be able to recover the whole Nextcloud install in case of failure,
# not just the files so we will backup the config too.
SAVE_FOLDER='/mnt/samba/nextcloud/'
NEXTCLOUD_FOLDER='/var/snap/nextcloud/common/nextcloud/'
ARCHIVE_TIMESTAMP=$(date +"%m_%d_%Y")
# Just in case
mkdir $SAVE_FOLDER
# Stopping Nextcloud, comment this line if you don't want downtime
snap stop nextcloud
tar -zcpf /$SAVE_FOLDER/nextcloud-backup-$ARCHIVE_TIMESTAMP.tar.gz $NEXTCLOUD_FOLDER
gpg -c /$SAVE_FOLDER/nextcloud-backup-$ARCHIVE_TIMESTAMP.tar.gz
rm /$SAVE_FOLDER/nextcloud-backup-$ARCHIVE_TIMESTAMP.tar.gz
snap start nextcloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment