I have a dotnet Server Application that i start like this to run it even when the console is closed.
nohup dotnet app.dll --urls=http://adress/ &
i want to create a bash script that restarts it infinite by itself when it has some issue and breaks and found some solution here like this:
while true; do ./app && break; done
I tried to encapsulate my code like this.
while true; do nohup dotnet app.dll --urls=http://adress/ & && break; done
which does not work because of the & && (the first & is a configuration for nohup) Then i tried to create just a second bash script and run it like this.
while true; do ./secondbashscript && break; done
While the second bash script consists of the nohup dotnet line.
But i had some trouble to get it running and i don't want to be stuck in an infinite loop which i expect. Instead it should just start the dotnet application and restart it but don't start it more than once at a time.