arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

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.

hashtag
Windows

See screencast here: https://www.ortussolutions.com/blog/screencast-starting-commandbox-servers-as-a-windows-servicearrow-up-right

hashtag
MacOS

Coming soon...

hashtag
Ubuntu (init.d)

Coming soon...

hashtag
CentOS/RHEL (system.d)

Create a .service file

as follows:

Start the service

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

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

nano /usr/lib/systemd/system/mySite.service
[Unit]
Description=mySite Service

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

[Install]
WantedBy=multi-user.target
systemctl start mySite.service
systemctl status mySite.service
systemctl enable mySite.service