.net core console application on PCF

935 views Asked by At

I'm able to deploy a .net core console app on PCF which raises some internal events and runs for sometime(with help of Thread.Delay()) and exits. I want to be able to start and stop this app remotely, using a batch file from windows machine.

When I push this app to PCF I have explicitly put --no-start flag in the push command. The app gets deployed and doesn't starts and I can start this remotely with cf start command. Once it exits successfully PCF tries to restart it considering it as crashed so in order to restart i would first need to cf stop and then use start command.

I need help in understanding - if there is any other better way to do this. Originally we were planning to use Tasks on PCF; but as per my understanding Tasks are command which runs on other application(please correct me if I am wrong)

Any thoughts will help. Thanks in advance.

1

There are 1 answers

0
arpymastro On BEST ANSWER

I modified my app logic to achieve this. I did the following -

  • Deployed app with --no-start flag
  • In the app entry method I checking the value of arg passed from command line
  • if arg==required_key then run the job else return
  • I do a cf start which builds, stages the app and the app gets started but no results displayed on console
  • cf stop
  • cf run-task APP_NAME "dotnet appname.dll required_key"

The above task runs one time and destroys itself.