> For the complete documentation index, see [llms.txt](https://manual.microbial-genomes.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.microbial-genomes.org/part5/advanced-configuration.md).

# Advanced configuration

MiGA allows flexible execution using a number of techniques, mainly setting [project metadata flags](/part5/metadata.md#project-flags), [dataset metadata flags](/part5/metadata.md#dataset-flags), and through the [daemon configuration](/part4/daemons.md).

These are some examples of advanced behaviors that can be configured in MiGA

## Controlling many daemons at once

The [MiGA CLI](https://github.com/bio-miga/miga/tree/7d5b5d8ca7b592d2dd8e085f33813de3ea42030a/manual/part3/miga-cli.md) includes support for mass-controlled daemons when several MiGA projects are in the same folder using the `miga lair` command.

The MiGA Lair will find all the MiGA projects in a folder (or subfolders) and control all the corresponding daemons together:

```bash
# Check the current status of all the daemons
miga lair list -p /path/to/folder

# Terminate all the daemons at once
miga lair terminate -p /path/to/folder

# Launch and daemonize a process to keep all daemons running
miga lair start -p /path/to/folder

# See more options
miga lair -h
```

## Sending an email when the project is ready

If your project runs for a long time and you want to be notified by email when it's ready, you can use [project hooks](/part5/metadata.md#project-hooks):

```bash
# First cd to the project folder
cd /path/to/project

# And open the MiGA Console
miga c
```

In the MiGA Console:

```ruby
# Set the hook "on_preprocessing_ready" to
# execute a shell command ("run_cmd") consisting of
# sending an email with the project path ("{{project}}")
MiGA::Project.load('.').tap do |p|
  p.metadata[:on_preprocessing_ready] = [
    ['run_cmd', 'echo \'Project ready: {{project}}\' | sendmail me@example.com']
  ]
end.save
quit
```

Make sure to change `/path/to/project` to the project path and `me@example.com` to the email where you want to receive the notification. Also, note that depending on your `sendmail` configuration you might get that email in the spam folder (or flat-out rejected), so make sure to test `sendmail` first.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.microbial-genomes.org/part5/advanced-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
