Copy/Sync one directory to another directory on local Truenas

fsociety3765

Explorer
Joined
Feb 2, 2021
Messages
61
Hi all,

I have a directory in a dataset on pool0, that I want to copy/sync with another directory on a dataset in pool1.

I thought this would be an easy task but I am struggling.

I did kick it off using the cp command via SSH which was working OK, but it stopped before completion when I put my computer to sleep. So now I have around 90% of the content copied over, I just need to sync the rest.

I have tried doing this through the shell window in the web interface, which does work but stops whenever you navigate away from the shell. I need a way to do this as background process. I looked at Rsync task but I can seem to figure out how use that when copying/syncing files locally. The replication task only seems to work for full datasets, so no help there, and the cron job doesn't seem to work. I put in the rsync command I needed, but when I try to run the cron job now, it completes instantly like it hasn't done anything.

Any help would be greatly appreciated. Is there perhaps a flag I can set in the command on the command line to tell it to run as a background job so it doesn't stop when I close my SSH session perhaps?

Thanks,
FS
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
What you probably want is (for a one-time thing) to use rsync -au /source /destination

But run that in a tmux session so it stays running when you disconnect.

tmux new-session -d -s copysession 'rsync -au /source /destination'

Which starts a tmux session named copysession and launches the rsync in it and detaches (so your computer can go to sleep or whatever).

you can then run tmux attach -t copysession at any time to check it. CTRL+B, then D to detach again.
 
Top