Moving Old Files Between SMB Share Mounts

KazuyaDarklight

Dabbler
Joined
May 8, 2019
Messages
36
I know for many situations, its best to manipulate SMB shared files from a Windows machine, but I have an automated process I want to implemment so if I can do it via cron so its all self contained on the FreeNAS server I'd like to, rather than having a script running on another, otherwise unrelated server.

Once a week, we want to have a process run that checks a directory with project folders in it, if the contents of a project folder have not been modified in 6 months, the project folder is then moved to an archive dataset on another pool. Booth the projects directory and the archive are SMB shares, we'd like the folders/files to inherit the archive permissions when they are moved there.

Would we be ok doing this as a cronjob script, or do I need to set this up on a windows machine.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
I know for many situations, its best to manipulate SMB shared files from a Windows machine, but I have an automated process I want to implemment so if I can do it via cron so its all self contained on the FreeNAS server I'd like to, rather than having a script running on another, otherwise unrelated server.

Once a week, we want to have a process run that checks a directory with project folders in it, if the contents of a project folder have not been modified in 6 months, the project folder is then moved to an archive dataset on another pool. Booth the projects directory and the archive are SMB shares, we'd like the folders/files to inherit the archive permissions when they are moved there.

Would we be ok doing this as a cronjob script, or do I need to set this up on a windows machine.
If your archive path is /mnt/dozer/archive, you can set the acl you want on /mnt/dozer/archive, and at the end of your cronjob call winacl -a clone -r -p /mnt/dozer/archive. Clone is pretty fast (on fast pools with good hardware I've seen it reset calculate and set inherited ACL at a rate of about 5000 files per second).

To be clear, this will calculate an inherited ACL from /mnt/dozer/archive, and apply that ACL to _all_ files under that path.
 

KazuyaDarklight

Dabbler
Joined
May 8, 2019
Messages
36
You're the man anodos. Thank you for always being here for me with my stupid questions. Now I just need to figure out how to actually write this script.
 
Top