Control Filemaker Server via Lasso
In today's article, we'll look at how you can control a Filemaker Server from Lasso.
Controlling FileMaker Server via Lasso
Using the Lasso [OS_Process] tags it is easy to control a Filemaker Server. Filemaker Server comes with a command line tool that allows you to get info such as the status or list of clients, files, plugins, backup schedules,... you can even open and close databases.
Example 1
The following example shows you a list of clients currently connected to your Filemaker Server:
[var:'fmps_user'='your FMPS admin user here']
[var:'fmps_passwd'='your FMPS admin password here']
[var: 'myProcess' = (OS_Process: '/usr/bin/fmsadmin', (Array: 'LIST','CLIENTS', '-y', '-u'+$fmps_user, '-p'+$fmps_passwd))]
[Encode_break: $myProcess->Read]
[$myProcess->Close]
This code will return something like :
Client ID User Name Computer Name Ext Privilege
1 Lieven Gekiere IntelMac20 fmapp
Example 2
The code below will create a backup of all files on your Filemaker Server and put that backup in the default backup folder:
[var:'fmps_user'='your FMPS admin user here']
[var:'fmps_passwd'='your FMPS admin password here']
[var: 'myProcess' = (OS_Process: '/usr/bin/fmsadmin', (Array: 'BACKUP', '-y', '-u'+$fmps_user, '-p'+$fmps_passwd))]
[Encode_break: $myProcess->Read]
[$myProcess->Close]
Note that the code above won't give you any output if the backup was successful. Using this code you can create backups of your files 'on demand' via a webpage.
Example 3
This example will output a list of hosted files on the FileMaker Server:
[var:'fmps_user'='your FMPS admin user here']
[var:'fmps_passwd'='your FMPS admin password here']
[var: 'myProcess' = (OS_Process: '/usr/bin/fmsadmin', (Array: 'LIST','FILES', '-y', '-u'+$fmps_user, '-p'+$fmps_passwd))]
[Encode_break: $myProcess->Read]
[$myProcess->Close]
This outputs something like:
filemac:/MacintoshHD/Library/FileMaker Server/Data/Databases/Sample/FMServer_Sample.fp7
filemac:/MacintoshHD/Library/FileMaker Server/Data/Databases/mytest.fp7
For a full list of available commands enter the following on the command line of the Filemaker Server box:
fmsadmin help commands
All these examples are for Mac OS X, but the same procedure can be used on Windows as well.
