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. Here is a guide on each major OS type.

Windows

Coming soon...

MacOS

Coming soon...

Ubuntu (init.d)

Coming soon...

CentOS/RHEL (system.d)

Create a .service file
1
nano /usr/lib/systemd/system/mySite.service
Copied!
as follows:
1
[Unit]
2
Description=mySite Service
3
4
[Service]
5
ExecStart=/usr/bin/box server start /var/www/mySiteAPI/server.json
6
Type=forking
7
8
[Install]
9
WantedBy=multi-user.target
Copied!
Start the service
1
systemctl start mySite.service
Copied!
Give the service about a minute to load up, then check its status
1
systemctl status mySite.service
Copied!
Once you've verified the service is running as expected, enable the service to load at boot
1
systemctl enable mySite.service
Copied!