I would nest the DynamicSupervisor under another Supervisor with the strategy :rest_for_one and also add a setup Task after the DynamicSupervisor in that supervisor.
Supervisor(strategy: :rest_for_one)
|----> DynamicSupervisor
|----> SetupTask / GenServer
If your DynamicSupervisor crash it will be detected by the Supervisor.
- It will kill the SetupTask / GenServer
- restart DynamicSupervisor
- restart your SetupTask / GenServer






















