Last active
November 13, 2018 21:58
-
-
Save Belval/8a1d87591be50ff2666c550aff58b908 to your computer and use it in GitHub Desktop.
Script to backup Nextcloud install on Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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