SpaceinvaderOne/Unraid_ZFS_Auto_Dataset_Update

Multiple Datasets in one Script

Revan335 opened this issue · 5 comments

Hello,

currently you need one script per dataset. For example appdata and domains. Why not one script with both or more?
For example source_dataset=("appdata" "domains" "third" ....)

Many Thanks!

Greetings

Revan335

Thankyou Revan335 for taking the time open an issue.
I want to leave this script as it is (however the list dataset script i have updated)
The reason i want to leave this script just for one dataset is that way each dataset can be run on a separate script at different times and schedules.

@Revan335, with a few slight modifications, I modified this script to fit my needs which is what you also requested. Please see ZFS_Auto_Dataset_Update_Multiple.

Thank you @SpaceinvaderOne for all your work and for all that you do including this script. I created a separate .sh file if you would like a merge so that you keep your original untouched.

Just wanted to share.

@townsste Can you update your Script with the newest Version?

@Revan335 I have put together a new v2 script which handles multi datasets , auto shutting down containers and vms and various safety checks etc.
Usage.
Regular datasets
For datasets that aren't designated as "appdata" or "vms", add their paths to source_datasets_array. There's no limit on how many datasets you can add.

Appdata and vm datasets
Do not add the paths of "appdata" or "vms" datasets directly to the array. Instead:

Specify whether you want to process appdata or vms by setting their respective variables to "yes".
Define the locations for appdata and vms by setting their corresponding variables.

The script will then automatically incorporate these paths into the source_datasets_array for processing.

Processing containers, the script can tell if the running container's appdata is already in a dataset. If they are, it will leave that container running. Otherwise, the container will be stopped in preparation for conversion.

Processing vms , again the same. if their vdisks are already in a zfs dataset they will be left running. Otherwise shut down for conversion

Once these checks and shutdowns (if needed) are finished, the script will convert regular folders in the source locations into zfs datasets. Then it will restart any stopped containers and vms and then display a summary of the converted datasets.

Thanks @townsste i added array as you did to the create function