2

Hi I have a question I have 3 application, and I want to start them when system is booting up. So i though I use rc.local file, but there seems to be a problem. It looks like application are started parallel but my applications are depended on each other, that means app1 starts then app2 starts.

My rc.locale:

#!/bin/bash

dotnet /srv/DiagAC2/WebApi/MDP.Api.dll &
dotnet /srv/DiagAC2/Hub/CL.Hub.dll &

exit 0

Is there a way in Ubuntu to start application in some specific order?

  • 1
    Drop the ampersand? That one is detaching them from the script so makes those 2 parallel. Otherwise you will need to learn how to use systemd That one can start units based on other units that need to be started 1st ;-) – Rinzwind May 28 at 13:04
  • remove all ampersands? – Wojciech Szabowicz May 28 at 13:13
4

If you don't want to execute them in parallel you can do this :

dotnet /srv/DiagAC2/WebApi/MDP.Api.dll && dotnet /srv/DiagAC2/Hub/CL.Hub.dll 

If the first one returns successfully ( return code of 0 ) then the second one gets executed.( you can replace the double ampersand && with semicolon ; to eliminate the successful return condition)

And if it doesn't take much time to get executed , you can add that line to your ~/.profile file in order to execute them every time you log in as your user.(but it may slow down the logging-in process.)

But if it takes so much time , you should consider creating a systemd service for it and you have to add the above command to the ExecStart option of your .service file (full path not just dotnet)

If there's any better solution , I'm glad to hear.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.