Script to backup folder to backup unraid server - not working


Recommended Posts

This is my first attempt using rsync.,   I have a script that I use which I got from space invaders video.  I am trying to convert it to back up a nextcloud folder to my backup unraid server.

 

When I run the script it creates an XML file on the backup server, which indicates 4th from bottom line is incorrect. Id be grateful for some assistance with this to get working.

 

#!/bin/bash
#backs up
#change the location below to your backup location 
backuplocation="/mnt/disks/192.168.1.201_backup/nextcloud"

# do not alter below this line
datestamp="_"`date '+%d_%b_%Y'`
dir="$backuplocation"/nextcloud/"$datestamp"
# dont change anything below here
if [ ! -d $dir ] ; then
 
            echo "making folder for todays date $datestamp"

            # make the directory as it doesnt exist
            mkdir -vp $dir
        else
            echo "As $dir exists continuing."
            fi

echo "Saving nextcloud files"
rsync -a --no-o /user/nextcloud $dir/xml/
chmod -R 777 $dir
sleep 5
exit

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.