The Support Group Blog

FileMaker Server Command Line

FileMaker Server: Don't Fear the Command Line

There is great power in the command line, especially with FileMaker Server. There are things you can't do easily any place else, except with using the command line. But as Uncle Ben shared with young Spider-Man, "With great power comes great responsibility."

Remember that old movie War Games? A high school student, David Lightman hacks into The Pentagon and manages to find an AI that has gone bad and is about to destroy the human race. Much of what you see in the movie is David interacting with the computer via the command line. Now, the command line interface today hasn’t changed much since those days, if at all. Here’s what it looks like on windows:

command-line-windows

 At the end of the movie, the AI tries to kill everyone, so I get it, the command line can be scary. You’re not sure what exactly to do or type and there are no safe guards in place to keep you from destroying everything. David Lightman typed the wrong thing and almost destroyed the world. You don’t want to be David Lightman.

Nonetheless, FileMaker Pro includes a great help system, and offers safeguards that will help you not destroy your entire FileMaker system. If you don’t already, you should have a test FileMaker Server installed somewhere. Open up the command line, and start exploring. See what you can do.

How do I find the command line?

If you’re like me, you can never remember where the command line is. So I tend to use the search tools available on the different platforms. On Windows, type “Command” into the search box – there are many places to do that – and you should see a program called “Command Prompt.” Once you have it open, pin it to the task bar.

command-line-windows-search

On the Mac, open up your spotlight search and type in “Terminal” and you’ll get the Mac’s version of the command line interface. 

command-line-mac-search

Once you have the program up and running, it should look like this:

command-line
 
Now that you have the command line open, what do you do?

The way the command line works is you type something in, hit enter and then if whatever you typed was correct, something should happen. So, for example, if you type in "fmsadmin help" and then hit enter, you should get a screen like this:

fms-admin-help

 Congratulations!! You just executed your first command line command. How do you feel? Is everyone still alive? Yes. Is your server on fire? No. Good.

Notice – for Filemaker server, EVERY single command starts out with “fmsadmin.” This is basically you telling the computer which subset of commands you want the computer to run. So get used to typing fmsadmin.

The very next command you should try is "fmsadmin help commands." Once you do, you should see a screen that looks like this:

fms-admin-help-commands

 This is a list of the commands you can run from the command line. You can see how this can be powerful. You can start the server, stop the server, start or stop JUST ONE component of the server, get a list of clients, etc. Lots of options. To find out what each command does, you can keep using the HELP command. Try "fmsadmin help restart."

What this should do is show you MORE information about the specific command you are looking at. Your screen should look like this:

fms-admin-help-restart

It basically breaks down what your command should look like, and what OPTIONS you can specify for each command. So, for example, if you wanted to force a restart of the whole database server, you would type "fmsadmin restart server -f --force." The options, or parameters, that you specify at the end of the command give you more control over what you want to do. This would shut down the database server, and immediately disconnect all the clients. Remember what I said about great power? You should definitely play around with this on a test server before you use it on a production server.

One thing I use this for on occasion is to restart the Admin Server. For one reason or another, sometimes the Admin Server can stop working. You know the database server is still running, because people are using the databases and you can still see the server when you click “open remote” on your client version of FileMaker Pro. But when you try to open up the Admin Console, nothing happens. Like with many things in the technology world, by simply restarting it you can sometimes fix something that has gone awry. So one thing I will try, instead of restarting the entire server, is to simply restart the Admin Server.

Type "fmsadmin restart adminserver" and you will see this:

fms-admin-restart-admin-server

 What this will do is simply restart the Admin Server process – the thing that manages the Admin Console. If you’re logged into the Admin Console, it will boot you out and make you log in again.

Another thing you can do is close and re-open databases, without having to log into the Admin console. Admittedly, it’s pretty easy to do this through the Admin Console, but it’s always good to have another way of doing things if you need to. As an example, I made 4 copies of the FMServer_Sample database on my local development server, and opened them up.

FM-Server-Sample-database

 Now if I want to close them with the command line, I simply type "fmsadmin close." This will ask you if you really want to close the databases, and then prompt you for the Admin Console username and password. It looks like this:

fmsadmin-close

 It even helpfully tells you it’s closing them as it goes along and confirms when they are closed. And this is what it looks like after on the admin console.

FM-Server-admin-console
 
Command Line Power

And that, dear readers, is where I’m going to leave you. I could tell you how to open the files back up with the command line – but where is the fun in that? You should be able to figure out how to do that on your own from here. Don’t be afraid! You can do it! And, you can find more tips and tricks on our Developer Resources page, including FileMaker security best practices and exporting custom headers.

Expand your FileMaker skills

Share this entry
0 replies
BrowseMode

Sign up to receive news and information about the FileMaker platform and other custom app development tools.

Keep me posted

Most Popular

Developer Resources

News, Tips & Tricks and Demos

Archives