Run initialization at startup
# help-with-umbraco
a
I would like to run some code at startup that will update some content nodes. The code only need to run once at startup and then no more. Any best practices on how this could be done?
c
Hi Abra! I would recommend taking a look at creating a custom Migration do to this! (Shameless plug) I've written an article describing what they are and how you can use them here: https://cornehoskam.com/posts/how-to-create-run-migrations-umbraco-v10
a
Thanks! I need to be able to run the code on every startup so the migrationpart was not exactly what I needed. But your article gave me some inspiration and especially for other kind of migrations that we most probably will need to make going forward
j
If it should run on startup each time then you can hook into the Umbraco lifetime notifications: https://docs.umbraco.com/umbraco-cms/reference/notifications/umbracoapplicationlifetime-notifications
103 Views