Brad Wood

December 22, 2016

Spread the word

Share your thoughts

It's beginning to look a lot like Christmas and depending on where you live, snow may be falling!  The only thing cooler than this weather is our 12 Tips of CommandBox Christmas series where today we'll dig into taming all those server environments.

Managing all your servers.

Some of you may only have one site you work on (lucky!) but others of us are always juggling several servers.  Maybe it's more than one CF engine on a single codebase, or perhaps you just have 3 or 4 clients projects going right now.  We've got some tips for keeping everything running.

Name your servers

Once you start a server for the first time, CommandBox will "remember" its name and allow you to issue any "server" command you want via the name.  You can specify the name you want to use, or by default, CommandBox will use the name of the folder that contains the site.  That default can be handy if you have your code in a folder called "project_abc" but less-than-desirable if every project has its code in a folder called "wwwroot" or something equally generic.

CommandBox> server start name=mySpecialServer 

Now that CommandBox knows your servers' names, you can start, stop, restart, view logs, etc of any server regardless of the current working directory of the CLI.  The first parameter to every "server" command is name which lets you do this:

CommandBox> start server1
CommandBox> start server2
CommandBox> restart  server3
CommandBox> stop server1
CommandBox> server log server2
CommandBox> server open server2

Get the 411

Want information on a server to check if it's running, what the web root is, etc?  Use the server info command.

# Get basic information
CommandBox> server info

# All the juicy details
CommandBox> server info --verbose

# In JSON format for external use!
CommandBox> server info --JSON

Can't remember a servers name, or just want a list of all your servers?  use the server list command.

# Every server you've ever started
CommandBox> server list

# All servers currently running
CommandBox> server list --running

# All servers currently stopped
CommandBox> server list --stopped

# All servers whose name includes the text foobar
CommandBox> server list foobar

Change directory to a server

This one is super helpful if you want to quickly jump to the web root of a server, but it's buried deep inside many folders.  The server cd will switch your current working directory straight to the web root of whatever server you specify.

CommandBox> server cd server1
CommandBox> ... do something in server1 ...

CommandBox> server cd server2
CommandBox> ... do something in server2 ...

Forgetta 'bout it!

To free up hard drive space and keep the list of servers clean, you can forget server that you're done working with.  This won't remove any of the code, but will erase any internal information about the server, CF settings, and your server.json file.  The next time you start the server will be like the first time again.  This can also be handy if you somehow screwed up your configuration or bungled a server update.

CommandBox> server forget






Add Your Comment

Recent Entries

Ortus Black Friday Deals are here!

Ortus Black Friday Deals are here!

Make 2023, the year you finally start modernizing your CFML projects with our Black Friday deals!

Don't waste any more time trying to find solutions, we got everything you need to rock your projects and learn new skills that will save you time and money while delivering a quality service. 

From Nov 25th to Dec 1st

Maria Jose Herrera
Maria Jose Herrera
November 25, 2022
Call For Speakers Open for Into The Box 2023

Call For Speakers Open for Into The Box 2023

We are very excited that the Into The Box conference is coming back to the Houston area and FINALLY on our normal schedule of May of 2023. Registration is now officially open and call for papers is now open as well. We are also extremely excited that this will be our 10 year anniversary for the Into The Box Conference. So we will defintely go all out!

  • Full 2-day conference with over 30 different technology topics
  • An additional full day of hands-on training available for a veritable 3 days of awesomeness
  • A warm and sunny city of The Woodlands, Texas
  • When: May 17-19 of 2023
  • Modernize Your Skillz
  • Party with our live Mariachi Band!

Luis Majano
Luis Majano
November 11, 2022
New Patreon Perk: Ortus Software Craftsmanship Book Club

New Patreon Perk: Ortus Software Craftsmanship Book Club

What is the Software Craftsmanship Book Club?

Its a place for CFML Community members can get together, discuss and debate the thoughts, ideas, best practices outlined by a series of books focusing on increasing Software Developers efficiency, productivity and pride. It will be relaxed but educational environment, where we can learn from each other, and grow as a community.


Ortus Software Craftsmanship Book Club

Maria Jose Herrera
Maria Jose Herrera
November 09, 2022