micronaut-picocli icon indicating copy to clipboard operation
micronaut-picocli copied to clipboard

CLI app as daemon?

Open bmarwell opened this issue 5 years ago • 7 comments

Task List

  • [ ] Stacktrace (if present) provided
  • [ ] Example that reproduces the problem uploaded to Github
  • [x] Full description of the issue provided (see below)

Steps to Reproduce

  1. Create a CLI app, with picolli
  2. Create a scheduled bean (a bean with any @Scheduled annotation).
  3. Run the app

Expected Behaviour

The app should run as daemon.

Actual Behaviour

The app does not find a http server and quits.

Environment Information

  • Operating System: Any, but Linux
  • Micronaut Version: 1.2.0
  • JDK Version: 11 (also tested 1.8), both openjdk-openj9.

Example Application

I think it's easy enough to reproduce.

Well If I leave out Picolli and add http-server-netty as a dependency, it works as expected. But in this case, I'd like to see CLI application which I can start using picolli CLI and the scheduler gets configured through picolli.

bmarwell avatar Aug 09 '19 19:08 bmarwell

Hi @graemerocher

This was not a question. It was a missing feature.

bmarwell avatar Feb 13 '20 13:02 bmarwell

I think you may need the micronaut-runtime dependency to schedule the jobs

graemerocher avatar Feb 13 '20 13:02 graemerocher

Thanks, hadn't found it in the docs when I opened this issue. I'll look it up and will give feedback soon.

bmarwell avatar Feb 13 '20 14:02 bmarwell

@graemerocher the application will just shutdown if I do not add a while(true) loop.

bmarwell avatar Apr 20 '20 08:04 bmarwell

I have a similar issue now, was this ever followed up or did you find a solution?

prshnt avatar Mar 10 '23 16:03 prshnt

@prshnt I interpreted the suggested solution to be adding a while (true) sleep(1000); loop to make sure the main thread never dies.

remkop avatar Mar 10 '23 23:03 remkop

@remkop ah okay. thanks.

prshnt avatar Mar 13 '23 09:03 prshnt