# alternative exit to quit in terminal

**URL:** <https://support.prodi.gy/t/alternative-exit-to-quit-in-terminal/569>\
**Category:** Uncategorized\
**Tags:** usage, ner, solved\
**Created:** [May 28, 2018, 11:54am UTC](https://support.prodi.gy/t/alternative-exit-to-quit-in-terminal/569 "2018-05-28T11:54:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![claire](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@claire](https://support.prodi.gy/u/claire)\
**Post date:** [May 28, 2018, 11:54am UTC](https://support.prodi.gy/t/alternative-exit-to-quit-in-terminal/569/1 "2018-05-28T11:54:34Z")

</div>

Hi,

I am trying to write a bash script to execute a workflow for making a database, annotate, combine with some other annotation files, train and evaluate. I am struggling to find a way to exit the prodigy server for the annotations stage. Each annotation file will have the same number of documents so perhaps I could use that and try kill it after that number of documents has been reached. Can you advise me on the best approach please?

Thanks.

---

<div class="post-metadata">

**Author:** ![honnibal](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/honnibal/32/35_2.png) [@honnibal](https://support.prodi.gy/u/honnibal)\
**Post date:** [May 29, 2018, 6:01pm UTC](https://support.prodi.gy/t/alternative-exit-to-quit-in-terminal/569/2 "2018-05-29T18:01:38Z")

</div>

Perhaps you could write a custom recipe that keeps the counter and terminates the server when your condition is reached? The custom recipe can call into the built-ins, so it’s quite easy to have a wrapper around the stream. The docs for this are here: [https://prodi.gy/docs/workflow-custom-recipes](https://prodi.gy/docs/workflow-custom-recipes)

If that won’t work, another place you could put the logic is in the `app.py`, which defines the REST service. We provided the source for this so that you’d be able to add endpoints if necessary. Perhaps you could add an endpoint that kills the server?

Finally, I don’t think there’s anything wrong with sending an exit signal to the process using `kill`.

---

<div class="post-metadata">

**Author:** ![Abinaya](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@Abinaya](https://support.prodi.gy/u/Abinaya)\
**Post date:** [March 17, 2020, 1:04pm UTC](https://support.prodi.gy/t/alternative-exit-to-quit-in-terminal/569/3 "2020-03-17T13:04:12Z")

</div>

Hey, I have the same question. But where can I find the app.py file? (Sorry for the silly question). I want to create an end point to exit the server once all images are annotated.

---

<div class="post-metadata">

**Author:** ![honnibal](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/honnibal/32/35_2.png) [@honnibal](https://support.prodi.gy/u/honnibal)\
**Post date:** [March 17, 2020, 1:06pm UTC](https://support.prodi.gy/t/alternative-exit-to-quit-in-terminal/569/4 "2020-03-17T13:06:09Z")

</div>

No problem!

It's just inside your Prodigy installation. You can run `python -m prodigy stats` and it should show you the directory Prodigy is installed within. The `app.py` will be within that directory.
