Jump to content

How to backup your NextCloud data directory


FunkyBuddha

Recommended Posts

Posted

Automate and schedule your NextCloud backups using the script below.

Notes:

  • Change the path of the NextCloud and Back Directory
  • This set up assumes a docker installation
  • It stops the NextCloud instance before backing up
  • Backup uses tar with compression to a remote folder. Filenames are date stamped
  • NextCloud starts after backup

 

Bash Script:

Quote

#!/bin/bash
NEXTCLOUD_DATA_DIR="/my/path/nextcloud"
BACKUP_DIR="/srv/remotemount/my/path/bkup"
sudo docker stop nextcloud

sudo tar -czf $BACKUP_DIR/nextcloud_data_backup_$(date +%F).tar.gz $NEXTCLOUD_DATA_DIR
sudo docker start nextcloud

 

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...