# Server administration

## Server start

Once your database has been properly configured and your config profile is set to use that database, you are ready to start your server using the omero admin start command:

    $ omero admin start

This command performs the following operations in order:

1. rewrites the configuration files if `omero admin start --force-rewrite` is passed or the server has never been started

2. checks the server status, i.e. pings the `master` node using the IceGrid administration tool

3. aborts the command if a server is running

4. rewrites the configuration files if it has not been done at step 1

5. starts the server

6. waits until the server is up

Most configuration files under `etc/grid` are generated using the templates under `etc/grid/templates` and the server configuration stored in `etc/grid/config.xml`. The rewriting step updates the JVM memory settings (see Memory configuration) and the server ports (see Ports) based on the server configuration.

-h, --help

  Display the help for this subcommand.

--foreground

  This option is particularly useful for debugging and maintenance and allows for starting the server up in the foreground, that is without creating a daemon on UNIX-like systems. During the lifetime of the server, the prompt from which it was launched will be blocked.

--force-rewrite

  This option forces the server configuration files under `etc/grid` to be rewritten before the status of the server is checked.

## Server stop

To stop a running server, you can invoke the omero admin stop subcommand:

    $ omero admin stop

This command does the following operations in order:

1. rewrites the server configuration files if `omero admin stop --force-rewrite` is passed

2. checks the server status, i.e. pings the `master` node using the IceGrid administration tool

3. aborts the command if no server is running

4. stops the server

5. waits until the server is down

-h, --help

  Display the help for this subcommand.

--force-rewrite

  This option forces the configuration files to be rewritten before the server status is checked.

## Server restart

To stop and start the server in a single command, you can use the omero admin restart command:

    $ omero admin restart

The `restart` subcommand supports the same options as omero admin start.

## Server diagnostics

To debug a server or inspect the configuration, you can use the omero admin diagnostics command:

    $ omero admin diagnostics

The output of this command will report information about:

- the server prerequisites (psql, java)

- the server environment variables

- the server memory settings and ports

- the status of the binary repository