AnsweredAssumed Answered

Control FMS 17 on remote Mac via scripting (shell or AppleScript or other?)

Question asked by DavidThorp on Jul 20, 2018
Latest reply on Jul 20, 2018 by DavidThorp

Let's say:

I have a Mac (call it Mac B) running FMS 17 with ip address

And I'm on Mac A with ip address


I want to write shell script(s) or AppleScript(s), or some other scripting if any exists, that I can run on Mac A to control the FMS on Mac B.


I've thought of a few ways to do this, all of which I would think should work but none of which do:


Option 1. ssh -> fmsadmin


ssh <mac-username>@ fmsadmin list files -u <fms-username> -p <fms-password>


Ssh password not required because i've set up ssh authentication key pairs.

This is the official unix way this should work, but instead I get:


bash: fmsadmin: command not found


This is weird because fmsadmin certainly is there and if i ssh in first, and then start issuing fmsadmin commands it all works fine, so fmsadmin is there.


And I'm pretty sure I have the syntax right for the ssh stuff because because other commands work:  eg. replace all the fmsadmin stuff with ls and it correctly returns a directly listing of <mac-username>'s home folder on Mac B.


But ok, if you really can't find it, then let's help you along with:


ssh <mac-username>@ "/Library/FileMaker\ Server/Database\ Server/bin/fmsadmin" list files -u <fms-username> -p <fms-password>


Seems it finds it then, but instead I get:


/Library/FileMaker Server/Database Server/bin/fmsadmin: Permission denied.

Error: 9 (Access denied)


How am I denied access if doing exactly the same in separate steps works fine?





Option 2. fmsadmin command line with -i option.


fmsadmin list files -i -u <fms-username> -p <fms-password>


As far as I'm aware this used to be a documented option in the fmsadmin CLI tool.  It doesn't seem to be documented now, but the error it gives suggests it's still available.  The error is:


IP Address '' is inaccessible or invalid.  Error: 10502 (Host unreachable)


The ip address is reachable by every other means, so I'm not sure why this says it isn't.  And if the option wasn't available any more, I'd think it would give a different error like "invalid option" or something.





I've written some comprehensive AppleScripts that  do shell script "fmsadmin..." perfectly well if I physically run them on Mac B.  And the fmsadmin tool works perfectly on Mac B if I run it in the terminal there.  And if I ssh in from Mac A to Mac B and then start issuing fmsadmin commands that all works perfectly well too.


So why won't either of these work?  Or... is there any other way to script controlling FMS 17 on a remote Mac?


For what it's worth, I'm able to do almost everything I want to do with the FMS Admin API, since that does work remotely, but as far as I can tell from the documentation, there's no way with that API to start and stop the FMS (does anyone know otherwise?).  So CLI is the only other option I can think of.  So if the best anyone can do it help me figure out just how to start and stop FMS remotely via scripting (with some feedback and results that I can use for error checking or whatever, as is the case with the CLI), then that'll do for now at least.


Any help would be greatly appreciated... Thanks!




Mac A: 2017 MacBook Pro 15" 16GB RAM, macOS 10.13.6

Mac B: 2014 MacBook Air 11" 8GB RAM, macOS 10.13.6, FMS 17.0.2