# Starting and stopping Discovery

Use the Discovery control script, `discovery.sh`, to start and stop Discovery.

## Starting Discovery

Before starting Discovery, start the database server that Discovery is configured to use.

By default, Discovery is configured to use an example HyperSQL database suitable for evaluating a single Discovery server. To start the example HyperSQL database, run the command below:

`$sql/hsqldb.sh start` ### Starting Discovery as a background process To start Discovery as a background process that logs to `logs/discovery.log`, use the `start` command: `$ ./discovery.sh start`

If Discovery is already running, this command restarts Discovery.

For information on changing default log location, name, and rolling behaviour, see Discovery log files.

### Starting Discovery as a foreground process

To start Discovery as a foreground process that logs to STDOUT, use the `start` command with option `-f`:

### Stopping a Discovery foreground process

To stop a Discovery server running as a foreground process, use one of the methods below:

• Press Ctrl-C in the terminal running Discovery.

• Send the process a TERM signal:

`$kill pid` • If Discovery is running in a container, stop the container. ## Retrieving Discovery status To determine if Discovery is running as a background process, use the `status` command: `$ ./discovery.sh status`

This command prints the status of Discovery to STDOUT, and exits with status code 0 if Discovery is running or status code 1 if Discovery is not running.