Sorry before my last request.
I had completely overlooked the syntax.
I have now corrected the syntax and checked the script on a test instance. I hope I have not overlooked anything.
I have extended the script and fixed some bugs. The most important one:
The detection of whether "onboot" should be started was defective.
The LCX or VM containers are restarted a maximum of 3 times.
The detection of the IP address had a bug, the variable was not reset, so if none was found, the last determined one was used.
I have improved the log output.
Additionally I added an email output in case of restarts. Email is disabled by default.