stop or start application ?

Hello,

How to stop or start not a service but an application.

This command works but I would like an “ansible syntax” :

- name: “stop my application”
command: home/ …/ …/my_application stop

This command works but i want an “ansible syntax” please guy.

Thank you very much ansible comunity !! :wink:

hi all,

UPPP please !!

Someone have an idea please guy !! :slight_smile:

If your program 'my_application' is capable of stopping itself when invoked with argument 'stop', then what you have is correct.

I don't see any Ansible anti-pattern here.

Services and an applications are the same things, it's just different semantics.
It's the way they're being managed that's different.
I would suggest you create a template task to ensure a systemd unit
exists, so that it fits in the existing framework to manage services.
Once you have that, you can use the service module.
If that means "more ansible" to you, then great.
Having such a systemd unit in place also has other benefits too, of course.

Dick

Thank you for answer Dick Visser,

But can you please give me one exemple with this task:

- name: “stop my application”
command: home/ …/ …/my_application stop

With syntax ansible so with “service” or “systemd” please Dick.

I think that you are the best, thank you !! :slight_smile:

Hi

That very much depends on what "my_application" is, what PID files it
uses (if any), if it's meant to run in the foreground, if it forks,
how it handlers errors, how it needs to be restarted, reloaded, etc,
etc.
It does not have much to do with Ansible, it's generic system administration.
If you need pointers, search for "systemd unit files".
This is all assuming that your server OS actually uses systemd as its
init system (you haven't told us).

Dick