We keep the echo statements in so it doesn't look like magic and we put the sleep in the restart script because it often won't work if you stop and then straigght away start background services.
We always stop the FileMaker server before doing an update/upgrade.
I always use a text expansion tool for this. I then just type "fmsstop#" into the terminal and the tool then enters the complete command including the following return.
On macOS, this can also be done with on-board tools.
Good tips! I find it somewhat ironic that (A) the FMS installer runs all sorts of scripts that affect macOS data and processes. Yet the one missing piece is that the FMS installer won't offer to stop the FileMaker server processes which it controls, and (B) the instructions for how to do this are hidden behind the error message.