We are running node application in Azure Virtual Machine, meanwhile we also want to restart VM at some certain time with the help of Azure Automation (or via management portal).
But how can we restart the node application after VM restarted?
We tried a lot of ways to achieve this, including add the Task Scheduler, add command to the registry key (LocalMachine\..\Run
), use Custom Script Extension for VM ...
All above failed. What we want is after the VM restart, the node application can be started automatically. If we then remote to the VM with predefined account, some of above ways can work. However, this is not the scenery, we only want to remote only once at the beginning, not every restart.
So, what't the right way to achieve this, to start a process or execute a command after VM automatically restart without manually login?