Is there a way to close (or stop hosting) a database from a script command?
You mean a FileMaker script or a batch (shell) script?
+1 to Mike_Mitchell
The only alternative I can think of is using CMD/bash triggered from a FileMaker client to connect using telnet or SSH to the server and run fmsadmin there remotely. I've never done it, but it looks plausible.
It's tricky to do because the fmsadmin command requires user input (username, password and confirmation) to close files. Automating this input with a batch or shell script isn't straightforward. From my research and testing it looked like additional software would be required to get it to work.
I don't think you need additional software. Bash should be able to feed passwords and you can login with the correct user for the remote session. CMD could be trickier, I agree, you might use an extra utility.
Would you mind sharing your research, just post a few related links may be? This will be related to the discussion topic in any case.
It was CMD I was most interested in and apparently fmsadmin takes input from the console, which is harder to automate.
On the bash side, the only link it looks like I saved was this one, about Expect: 6 Expect Script Examples to Expect the Unexpected (With Hello World)
I never got it to work but, as I was focused on CMD I didn't try too hard.
Here's an example (courtesy of Wim DeCorte).
THanks for sharing this!
Thanks, Mike_Mitchell . So, you can pass username and password in cmd as well, no need for anything extra. I am sure I have scripted this before. There is a question of security, as the username and password could be traced in FileMaker script or .bat file.
alecgregory thanks for sharing. cmd command/script could be run from FileMaker client with Send Event on the background, it is actually ideal for the automation. If you are talking about regular tasks, Server can run the .bat files on schedule, including the ones which will issue fmsadmin commands.
Retrieving data ...