Creating Nextcloud backups

I am pretty new to Linux so please bare with me.

What I’m trying to accomplish:

creating backs ups of the the nextcloud directories and a MYSQL backup of my database that runs automatically.

Where I would like to send my back ups:

I would like to send my backups to an external drive.

Currently my Ubuntu Server runs off a Hyper-V VM. So I would like to have these backs ups go to the external drive hooked up via USB on my main Windows server.

Any recommendations and help would be appreciated.

You could share the external drive via SMB, mount that in your Ubuntu server and then create a cronjob to regularly execute this script with option -ob to create backups:

Thank you for the information. I was able to mount the SMB share and setup a cron job with Rsync

Another howto :wink:

This looks Great!! quick question im using apache2 for the webservice will this bash still work with that if i alter the name from Nginx? Also im using MYSQL and not Maria DB? any advice with changing that in the script? sorry new to all of this trying to learn as i go. Also im a bit confused as what it means by “webserverusr” would that be the account i login to nextcloud with via the web?

Ok so i answered my own questions, I ran the script manually after altering it and when it got to the SQL DB backup it prompted for a password i entered it, it then stopped the script. (it did take the backup of SQL) but i had to manually turn maintenance mode and apache2 back on. Any Ideas why ?

alright, I got it all situated and working great. Thanks for the How to!