> For the complete documentation index, see [llms.txt](https://commandbox.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://commandbox.ortusbooks.com/6.0.0-1/embedded-server/starting-as-a-service.md).

# Starting as a Service

When using CommandBox on a staging or production server, you may wish to start up servers as a service when the OS comes online. The recommended approach is to use the [**CommandBox Service Manager Module**](https://www.ortussolutions.com/products/commandbox-service-manager), which is a commercial module that handles all major operating systems (Linux, Mac, Windows) automatically.

![CommandBox Service Manager](https://content.gitbook.com/content/ONdJADJ0fLlEUO9jMs3X/blobs/wtXudIosXPrlQVvWNKYo/image%20\(9\).png)

See screencast here:

{% embed url="<https://www.ortussolutions.com/products/commandbox-service-manager>" %}

Alternatively, you can manually do so following one of these community guides.

## Windows

See screencast here: <https://www.ortussolutions.com/blog/screencast-starting-commandbox-servers-as-a-windows-service>

## MacOS

Coming soon...

## CentOS/RHEL/Ubuntu (system.d)

Create a `.service` file

```
nano /usr/lib/systemd/system/mySite.service
```

as follows:

```
[Unit]
Description=mySite Service

[Service]
ExecStart=/usr/local/bin/box server start /var/www/mySiteAPI/server.json
Type=forking

[Install]
WantedBy=multi-user.target
```

Start the service

```
systemctl start mySite.service
```

Give the service about a minute to load up, then check its status

```
systemctl status mySite.service
```

Once you've verified the service is running as expected, enable the service to load at boot

```
systemctl enable mySite.service
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://commandbox.ortusbooks.com/6.0.0-1/embedded-server/starting-as-a-service.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
