Sync directories between two UnRaid servers


Recommended Posts

So how would you append it to the file listed above -

 

sync -a --progress --log-file=/mnt/cache/apps/RSYNCLOG.log /mnt/disks/godzilla_pictures/ /mnt/user/godzilla/pictures

 

Here's how I've appended it

 

rsync -avh --log-file=/mnt/user/godzilla/pictures/pictures-backup.log --stats /mnt/disks/godzilla_pictures/ /mnt/user/godzilla/pictures

 

then my notifications call looks like this

/usr/local/emhttp/webGui/scripts/notify -s "`hostname` Rsync Backup complete" -i "normal" -d "Backup of Pictures share complete `date` `tail /mnt/user/godzilla/pictures/pictures-backup.log`"

Link to comment

deionmann

 

thanks for all the input.

 

Hopefully a simple question but what is the last part and how does it work?

 

/usr/local/emhttp/webGui/scripts/notify -s "`hostname` Rsync Backup complete" -i "normal" -d "Backup of Pictures share complete `date` `tail /mnt/user/godzilla/pictures/pictures-backup.log`"

 

I got your first command to work on a test yesterday....pointing to my needs and it created the log file...again thanks!

sync -a --progress --log-file=/mnt/cache/apps/RSYNCLOG.log /mnt/disks/godzilla_pictures/ /mnt/user/godzilla/pictures

Link to comment

deionmann

 

thanks for all the input.

 

Hopefully a simple question but what is the last part and how does it work?

 

/usr/local/emhttp/webGui/scripts/notify -s "`hostname` Rsync Backup complete" -i "normal" -d "Backup of Pictures share complete `date` `tail /mnt/user/godzilla/pictures/pictures-backup.log`"

 

I got your first command to work on a test yesterday....pointing to my needs and it created the log file...again thanks!

sync -a --progress --log-file=/mnt/cache/apps/RSYNCLOG.log /mnt/disks/godzilla_pictures/ /mnt/user/godzilla/pictures

 

-d == description part of the notification. I recommend that any file content attached to the notification is put in the message part (-m). So the example above becomes:

 

/usr/local/emhttp/webGui/scripts/notify -s "`hostname` Rsync Backup complete" -i "normal" -d "Backup of Pictures share complete `date`" -m "`tail /mnt/user/godzilla/pictures/pictures-backup.log`"

Link to comment

So that all that info gets written to /mnt/user/godzilla/pictures/pictures-backup.log?

 

or am I missing something in regards to /usr/local/emhttp/webGui/scripts/notify ?

 

No, it is the other way around. The content of the given .log file is attached to the notification.

 

Ps. You can make a reference to any file / content as is needed.

 

Link to comment

IS the following possible.

 

Setup an rsync job to do this.

 

Share is read only

Turn share to read/write

Move files

After files are moved turn back to read only\

 

I'm sure that is possible. I'm not sure what you tell SAMBA to do that, but I'm sure it's a thing you could do.

 

That said, if you use the ssh feature of Rsync instead of mounting the SMB share with unassigned devices (treating it like a local write), you wouldn't have to jump though those hoops.

 

The catch is that you've got to set up ssh keys instead of ssh passwords or else your script will prompt you to input a password when it goes to connect via ssh.

Link to comment

<CTRL> + <X> to exit and Save output. The cron Job is now saved. I have noticed that the dynamix cron files are not loaded just because you create a file BUT you can force this. Just go into the Settings>Scheduler AND make a change (so the Apply Button gets un-greyed out) and change it back (Apply Button remains un-greyed out) and Hit Apply (essentially not changing ANYTHING) then the cron file gets loaded.

 

Can't you also use?

update_cron

I know I've used it when changing a cron file.

 

Link to comment

IS the following possible.

 

Setup an rsync job to do this.

 

Share is read only

Turn share to read/write

Move files

After files are moved turn back to read only\

 

Guess I will have to do some digging on this.

 

I'm sure that is possible. I'm not sure what you tell SAMBA to do that, but I'm sure it's a thing you could do.

 

That said, if you use the ssh feature of Rsync instead of mounting the SMB share with unassigned devices (treating it like a local write), you wouldn't have to jump though those hoops.

 

The catch is that you've got to set up ssh keys instead of ssh passwords or else your script will prompt you to input a password when it goes to connect via ssh.

Link to comment

It's pretty simple again the problem is you have to setup SSH Key Login first.

 

But then your RSYNC call follows this format.

 

Access via remote shell:
  Pull: rsync [OPTIONS...] USER@HOST:/Source /Destination
  Push: rsync [OPTIONS...] /Source USER@HOST:/Destination

 

If you don't have SSH Keys set up, this will prompt you to log into the machine like normal, this of course is an issue if you are planning to set up a script executed by CRON, since that script requires manual input. If you have SSH Key Login set up with pre-shared keys it won't prompt you since you have the key.

 

Link to comment

OK so to build off of this say moving data from one disk to another on the same server....

 

Right now all my disk shares/User shares are set to secure which means they are read only correct?

 

Yet my cron job below can write to the disk?  why?

 

# Monthly test backup

38 17 * * * rsync -avh --progress --log-file=/mnt/cache/RSYNCLOG.log --stats /mnt/user/files/NetflixMCE_BETA /mnt/disk4/RAID_Test |& logger

 

Link to comment

OK so to build off of this say moving data from one disk to another on the same server....

 

Right now all my disk shares/User shares are set to secure which means they are read only correct?

 

Yet my cron job below can write to the disk?  why?

 

# Monthly test backup

38 17 * * * rsync -avh --progress --log-file=/mnt/cache/RSYNCLOG.log --stats /mnt/user/files/NetflixMCE_BETA /mnt/disk4/RAID_Test |& logger

 

It's not going though SMB at all, so SAMBA's (SMB server) permission schemes aren't being applied.

 

There is setting a file to be read only in Linux using chmod, and then there is setting SMB to deny write permission on a share... You are doing the latter when you change SMB settings. It's not actually changing the permissions on every file in that share.

 

Also be very careful when mixing /mnt/user/xxxx with /mnt/diskx/xxxx if there is a collision (IE attempt to write to the same place) it'll cause data loss.

Link to comment
  • 1 month later...
  • 1 year later...

Yes, I'm ressurecting an old thread...

 

So I am doing this to backup my unraid to a second NAS.      But after about 12 hours or so rsync terminates and my /mnt/user directory becomes inaccessable.   Even trying to go to it results in a "directory user transport endpoint is not connected" error.    Rebooting unraid fixes this issue, so I'm assuming it is an out of memory or swap file error or something like that.  I've seen a few people post about this issue in here but haven't found a definitive solution.   Anyone run into this? How did you solve it?

Link to comment
8 minutes ago, damelon said:

Yes, I'm ressurecting an old thread...

 

So I am doing this to backup my unraid to a second NAS.      But after about 12 hours or so rsync terminates and my /mnt/user directory becomes inaccessable.   Even trying to go to it results in a "directory user transport endpoint is not connected" error.    Rebooting unraid fixes this issue, so I'm assuming it is an out of memory or swap file error or something like that.  I've seen a few people post about this issue in here but haven't found a definitive solution.   Anyone run into this? How did you solve it?

Tools - Diagnostics, post complete zip, preferably after issue but before reboot.

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.