How can I gracefully shut down FileMaker Server on Mac Mini running MacOS14

On Windows I follow these steps:

  1. in admin console: closing all hosted files
  2. stopping FMServer in admin console
  3. in Windows Services stopping FileMaker Server

On MacOS first 2 steps same but 3. I am using the Terminal to run: sudo service fmshelper stop
is this the way to do it or am I missing something?

Thank you!

sudo launchctl stop com.filemaker.fms

Also check your Activity Monitor before shutting down. Search for "fm" to limit to fms related services.

If you need to restart from the terminal, use the same sudo command as above, with start instead of stop.

2 Likes

Great thanks! So all could be done via Terminal. Will see if I can figure out how to use a Terminal script to automize this or would that be not graceful for shutting down? I thought of a sequence closing all files then testing if all closed then proceeding with terminating all involved?

if you find a reliable way of determining when FMS has completed shutdown, so that it can be issued the start command, I'd be interested. I've been failing to get a shell script to do this accurately for a long time. I've resorted to a long pause which gets the job done but it annoys me that I don't have a better way.

1 Like

In case it's of use to someone, here's a PDF file with the FMSAdmin Command Line commands. It can be gathered from within Terminal as well, of course (fmsadmin HELP [OPTIONS]), but I like having it as a document. This is from FMS v16, but it's basically the same.

fms16_cli_help.pdf (210.6 KB)

4 Likes

This is very helpful indeed @daleallyn. I wish the FileMaker documentation would be as it was years before. Now it misses out IMHO. THANK YOU!

I normally just set a long time out - say four seconds before starting the service again.

We use web direct which is run under apache tomcat so the following works well.

ps aux | grep apache

and wait until there is no results.

The best way to do it would be to open the plist file as see what process it starts up - there might also be a default pid path - and then use `ps aux | grep {{processName}}

if nothing is returned then I start the process again.

I now however just use loop until the bash script can't find apache

#!/usr/bin/env bash

# Shutdown down FileMaker background services.
echo "/usr/bin/sudo /bin/launchctl unload  /Library/LaunchDaemons/com.filemaker.fms.plist"
/usr/bin/sudo /bin/launchctl unload  /Library/LaunchDaemons/com.filemaker.fms.plist

# Time to sleep between checks (in seconds)
SLEEP_DURATION=5

# We've noticed tomcat is running on our servers until 
# the FileMaker background services are shutdown.
# Loop to continuously check for the Apache process
while true; do
    # Check for the Apache process
    if ! ps aux | grep -v grep | grep apache > /dev/null; then
        echo "Apache process not found. Exiting."
        exit 0
    fi
    
    # Sleep for the specified duration
    sleep $SLEEP_DURATION
done

# Restart FileMaker background services.
echo "/usr/bin/sudo /bin/launchctl load -w /Library/LaunchDaemons/com.filemaker.fms.plist"
/usr/bin/sudo /bin/launchctl load -w /Library/LaunchDaemons/com.filemaker.fms.plist

The echo commands are there because I don't like magic scripts - I like to see what commands are actually being issued.

You've chosen Apache as the process to watch. I had been watching fms, perhaps that was my mistake.

I'm pleased to see that the current versions of FMS for Mac and Ubuntu, support Let's Encrypt and include shell scripts.

Malcolm

1 Like